- add re-try upon rate-limit http errors - fully implemented record filtering - add app-specified security fields - remove all hard-coded constants, putting in config class - add clearing of memoization in WebhookSubscriptionsHelper - add ad-hoc events - add "event details" to json content - fix health checker - add ActionFlag to omit webhooks - make test process optionally move unhealthy to probation
88 lines
4.3 KiB
Java
88 lines
4.3 KiB
Java
/*
|
|
* QQQ - Low-code Application Framework for Engineers.
|
|
* Copyright (C) 2021-2025. Kingsrook, LLC
|
|
* 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
|
|
* contact@kingsrook.com
|
|
* https://github.com/Kingsrook/
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Affero General Public License as
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
* License, or (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Affero General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
package com.kingsrook.qbits.webhooks.processes;
|
|
|
|
|
|
import java.util.List;
|
|
import com.kingsrook.qbits.webhooks.model.Webhook;
|
|
import com.kingsrook.qbits.webhooks.model.WebhookHealthStatus;
|
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
|
import com.kingsrook.qqq.backend.core.model.metadata.MetaDataProducer;
|
|
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
|
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData;
|
|
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldType;
|
|
import com.kingsrook.qqq.backend.core.model.metadata.layout.QIcon;
|
|
import com.kingsrook.qqq.backend.core.model.metadata.processes.QComponentType;
|
|
import com.kingsrook.qqq.backend.core.model.metadata.processes.QFrontendComponentMetaData;
|
|
import com.kingsrook.qqq.backend.core.model.metadata.processes.QFrontendStepMetaData;
|
|
import com.kingsrook.qqq.backend.core.model.metadata.processes.QProcessMetaData;
|
|
import com.kingsrook.qqq.backend.core.processes.implementations.etl.streamedwithfrontend.ExtractViaQueryStep;
|
|
import com.kingsrook.qqq.backend.core.processes.implementations.etl.streamedwithfrontend.NoopTransformStep;
|
|
import com.kingsrook.qqq.backend.core.processes.implementations.etl.streamedwithfrontend.StreamedETLWithFrontendProcess;
|
|
|
|
|
|
/*******************************************************************************
|
|
** Meta Data Producer for SendTestEventToWebhook
|
|
*******************************************************************************/
|
|
public class SendTestEventToWebhookProcessMetaDataProducer extends MetaDataProducer<QProcessMetaData>
|
|
{
|
|
public static final String NAME = "SendTestEventToWebhook";
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
**
|
|
*******************************************************************************/
|
|
@Override
|
|
public QProcessMetaData produce(QInstance qInstance) throws QException
|
|
{
|
|
QProcessMetaData processMetaData = StreamedETLWithFrontendProcess.processMetaDataBuilder()
|
|
.withName(NAME)
|
|
.withTableName(Webhook.TABLE_NAME)
|
|
.withIcon(new QIcon().withName("quiz"))
|
|
.withExtractStepClass(ExtractViaQueryStep.class)
|
|
.withTransformStepClass(NoopTransformStep.class)
|
|
.withLoadStepClass(SendTestEventToWebhookLoadStep.class)
|
|
.withSourceTable(Webhook.TABLE_NAME)
|
|
.withDestinationTable(Webhook.TABLE_NAME)
|
|
.withPreviewMessage(StreamedETLWithFrontendProcess.DEFAULT_PREVIEW_MESSAGE_PREFIX + " sent a test event")
|
|
.withReviewStepRecordFields(List.of(
|
|
new QFieldMetaData("id", QFieldType.INTEGER),
|
|
new QFieldMetaData("name", QFieldType.STRING),
|
|
new QFieldMetaData("url", QFieldType.STRING),
|
|
Webhook.TableMetaDataCustomizer.addHealthStatusChipAdornment(new QFieldMetaData("healthStatusId", QFieldType.INTEGER).withPossibleValueSourceName(WebhookHealthStatus.NAME))
|
|
))
|
|
.getProcessMetaData();
|
|
|
|
processMetaData.withStep(0, new QFrontendStepMetaData()
|
|
.withName("input")
|
|
.withComponent(new QFrontendComponentMetaData()
|
|
.withType(QComponentType.EDIT_FORM))
|
|
.withFormField(new QFieldMetaData("uponSuccessUpdateUnhealthyWebhooksToProbation", QFieldType.BOOLEAN)
|
|
.withDefaultValue("true")
|
|
.withLabel("Upon Success Update Unhealthy Webhooks To Probation?")));
|
|
|
|
return (processMetaData);
|
|
}
|
|
|
|
}
|