Simplify Recall webhook logic function config (#22026)
<!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/twentyhq/twenty/pull/22026?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
This commit is contained in:
+3
-27
@@ -1,10 +1,6 @@
|
||||
import { isNull, isUndefined } from '@sniptt/guards';
|
||||
import { CoreApiClient } from 'twenty-client-sdk/core';
|
||||
import {
|
||||
defineLogicFunction,
|
||||
type LogicFunctionConfig,
|
||||
type RoutePayload,
|
||||
} from 'twenty-sdk/define';
|
||||
import { defineLogicFunction, type RoutePayload } from 'twenty-sdk/define';
|
||||
import { Response } from 'twenty-sdk/logic-function';
|
||||
|
||||
import { RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/constants/recall-webhook-logic-function-universal-identifier';
|
||||
@@ -15,18 +11,6 @@ import { verifyRecallWebhookSignature } from 'src/logic-functions/recall-api/ver
|
||||
import { getApplicationVariableValue } from 'src/logic-functions/utils/get-application-variable-value.util';
|
||||
import { isNonEmptyString } from 'src/logic-functions/utils/is-non-empty-string.util';
|
||||
|
||||
type ServerWebhookTriggerSettings = {
|
||||
workspaceIdResolver: {
|
||||
source: 'body' | 'query' | 'header';
|
||||
path: string;
|
||||
};
|
||||
forwardedRequestHeaders?: string[];
|
||||
};
|
||||
|
||||
type RecallWebhookLogicFunctionConfig = LogicFunctionConfig & {
|
||||
serverWebhookTriggerSettings: ServerWebhookTriggerSettings;
|
||||
};
|
||||
|
||||
// Non-2xx makes Svix retry; a returned plain object would 200-ack permanently.
|
||||
const rejectWebhook = (status: number, error: string): Response => {
|
||||
console.error(`[twenty-meeting-bot] webhook rejected: ${error}`);
|
||||
@@ -80,7 +64,7 @@ export const recallWebhookRouteHandler = async (
|
||||
});
|
||||
};
|
||||
|
||||
const recallWebhookLogicFunctionConfig = {
|
||||
export default defineLogicFunction({
|
||||
universalIdentifier: RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER,
|
||||
name: 'recall-webhook',
|
||||
description:
|
||||
@@ -101,12 +85,4 @@ const recallWebhookLogicFunctionConfig = {
|
||||
'svix-signature',
|
||||
],
|
||||
},
|
||||
} satisfies RecallWebhookLogicFunctionConfig;
|
||||
|
||||
const recallWebhookLogicFunction = defineLogicFunction(
|
||||
recallWebhookLogicFunctionConfig,
|
||||
) as ReturnType<typeof defineLogicFunction> & {
|
||||
config: RecallWebhookLogicFunctionConfig;
|
||||
};
|
||||
|
||||
export default recallWebhookLogicFunction;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user