2
0

🚸 Rename "webhook" block to "HTTP request"

This commit is contained in:
Baptiste Arnaud
2024-02-16 12:04:25 +01:00
parent 8d50dc9dfa
commit 33cbb2b254
35 changed files with 165 additions and 154 deletions

View File

@ -1,10 +1,9 @@
import { Webhook as WebhookFromDb } from '@typebot.io/prisma'
import {
Block,
BlockV5,
PublicTypebotV5,
TypebotV5,
Webhook,
HttpRequest,
} from '@typebot.io/schemas'
import { isWebhookBlock, isDefined } from '../utils'
import prisma from '../prisma'
@ -54,9 +53,11 @@ const migrateWebhookBlock =
? {
id: webhook.id,
url: webhook.url ?? undefined,
method: (webhook.method as Webhook['method']) ?? HttpMethod.POST,
headers: (webhook.headers as Webhook['headers']) ?? [],
queryParams: (webhook.queryParams as Webhook['headers']) ?? [],
method:
(webhook.method as HttpRequest['method']) ?? HttpMethod.POST,
headers: (webhook.headers as HttpRequest['headers']) ?? [],
queryParams:
(webhook.queryParams as HttpRequest['headers']) ?? [],
body: webhook.body ?? undefined,
}
: {

View File

@ -7,7 +7,7 @@ import {
WorkspaceRole,
} from '@typebot.io/prisma'
import { createId } from '@paralleldrive/cuid2'
import { Typebot, TypebotV6, Webhook } from '@typebot.io/schemas'
import { Typebot, TypebotV6, HttpRequest } from '@typebot.io/schemas'
import { readFileSync } from 'fs'
import { proWorkspaceId, userId } from './databaseSetup'
import {
@ -154,7 +154,7 @@ export const updateUser = (data: Partial<User>) =>
export const createWebhook = async (
typebotId: string,
webhookProps?: Partial<Webhook>
webhookProps?: Partial<HttpRequest>
) => {
try {
await prisma.webhook.delete({ where: { id: 'webhook1' } })

View File

@ -8,7 +8,7 @@ import type {
Block,
TextInputBlock,
TextBubbleBlock,
WebhookBlock,
HttpRequestBlock,
ImageBubbleBlock,
VideoBubbleBlock,
BlockWithOptionsType,
@ -117,7 +117,7 @@ export const isIntegrationBlock = (block: Block): block is IntegrationBlock =>
) as any[]
).includes(block.type)
export const isWebhookBlock = (block: Block): block is WebhookBlock =>
export const isWebhookBlock = (block: Block): block is HttpRequestBlock =>
[
IntegrationBlockType.WEBHOOK,
IntegrationBlockType.PABBLY_CONNECT,