From ed5096e2b6b627adeebed04aa1ee7021be70c38e Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Mon, 18 Mar 2024 16:09:19 +0100 Subject: [PATCH] :recycle: Include forged blocks schema in typebot schema Closes #1364 --- apps/builder/package.json | 1 - .../features/editor/components/BlockCard.tsx | 11 +- .../editor/components/BlocksSideBar.tsx | 4 +- .../src/features/forge/ForgedBlockCard.tsx | 2 +- .../src/features/forge/ForgedBlockIcon.tsx | 2 +- .../src/features/forge/ForgedBlockLabel.tsx | 2 +- .../api/credentials/createCredentials.ts | 7 +- .../forge/api/credentials/listCredentials.ts | 4 +- .../features/forge/api/fetchSelectItems.ts | 7 +- .../forge/components/ForgeSelectInput.tsx | 5 +- .../components/ForgedBlockNodeContent.tsx | 2 +- .../forge/components/ForgedBlockSettings.tsx | 2 +- .../components/ForgedBlockTurnIntoMenu.tsx | 6 +- .../credentials/ForgedCredentialsDropdown.tsx | 6 +- .../credentials/ForgedCredentialsModal.tsx | 2 +- .../ZodActionDiscriminatedUnion.tsx | 5 +- .../ZodDiscriminatedUnionLayout.tsx | 5 +- .../components/zodLayouts/ZodFieldLayout.tsx | 5 +- .../components/zodLayouts/ZodObjectLayout.tsx | 5 +- .../features/forge/hooks/useForgedBlock.ts | 18 +- .../components/nodes/block/BlockNode.tsx | 2 +- .../features/graph/helpers/getHelpDocUrl.ts | 2 +- .../features/typebot/helpers/sanitizers.ts | 21 - apps/docs/openapi/builder.json | 6402 +++++++++++------ apps/docs/openapi/viewer.json | 6402 +++++++++++------ apps/viewer/package.json | 1 - .../api/integrations/openai/streamer/route.ts | 11 +- packages/bot-engine/continueBotFlow.ts | 15 +- .../bot-engine/forge/executeForgedBlock.ts | 5 +- packages/bot-engine/package.json | 1 - packages/embeds/js/package.json | 1 - packages/embeds/js/rollup.config.js | 13 +- packages/embeds/js/src/components/Bot.tsx | 3 +- packages/embeds/nextjs/package.json | 1 - packages/embeds/nextjs/rollup.config.js | 9 +- packages/embeds/react/package.json | 1 - packages/embeds/react/rollup.config.js | 9 +- .../anthropic/actions/createChatMessage.tsx | 8 +- packages/forge/blocks/anthropic/index.ts | 2 +- packages/forge/blocks/anthropic/schemas.ts | 6 + packages/forge/blocks/calCom/index.ts | 2 +- packages/forge/blocks/calCom/schemas.ts | 6 + packages/forge/blocks/chatNode/index.ts | 2 +- packages/forge/blocks/chatNode/schemas.ts | 6 + packages/forge/blocks/difyAi/index.ts | 2 +- packages/forge/blocks/difyAi/schemas.ts | 6 + packages/forge/blocks/elevenlabs/index.ts | 2 +- packages/forge/blocks/elevenlabs/schemas.ts | 7 + .../mistral/actions/createChatCompletion.ts | 8 +- packages/forge/blocks/mistral/index.ts | 2 +- packages/forge/blocks/mistral/schemas.ts | 6 + .../actions/createChatCompletion.tsx | 8 +- packages/forge/blocks/openRouter/index.ts | 2 +- packages/forge/blocks/openRouter/schemas.ts | 7 + .../openai/actions/createChatCompletion.tsx | 8 +- packages/forge/blocks/openai/schemas.ts | 6 + packages/forge/blocks/qrcode/index.ts | 2 +- packages/forge/blocks/qrcode/schemas.ts | 6 + .../actions/createChatCompletion.tsx | 8 +- packages/forge/blocks/togetherAi/index.ts | 2 +- packages/forge/blocks/togetherAi/schemas.ts | 7 + packages/forge/blocks/zemanticAi/index.ts | 2 +- packages/forge/blocks/zemanticAi/schemas.ts | 7 + packages/forge/cli/index.ts | 70 +- packages/forge/core/index.ts | 2 +- packages/forge/core/package.json | 3 +- packages/forge/core/types.ts | 3 +- .../repository/{index.ts => constants.ts} | 7 +- packages/forge/repository/credentials.ts | 36 + packages/forge/repository/definitions.ts | 26 + packages/forge/repository/package.json | 17 +- packages/forge/repository/schemas.ts | 36 + packages/forge/repository/types.ts | 10 + packages/forge/schemas/index.ts | 42 - packages/forge/schemas/package.json | 24 - packages/lib/package.json | 1 - .../schemas/features/blocks/forged/helpers.ts | 9 + packages/schemas/features/blocks/schema.ts | 11 +- packages/schemas/helpers.ts | 6 +- packages/variables/deepParseVariables.ts | 2 +- packages/variables/executeFunction.ts | 5 +- .../variables/extractVariablesFromText.ts | 2 +- packages/variables/findUniqueVariableValue.ts | 2 +- .../injectVariablesFromExistingResult.ts | 4 +- packages/variables/package.json | 3 +- packages/variables/parseGuessedValueType.ts | 2 +- packages/variables/parseVariableNumber.ts | 2 +- packages/variables/parseVariables.ts | 2 +- packages/variables/prefillVariables.ts | 4 +- .../variables/transformVariablesToList.ts | 2 +- packages/variables/types.ts | 13 + .../variables/updateVariablesInSession.ts | 34 +- pnpm-lock.yaml | 54 +- 93 files changed, 8599 insertions(+), 4965 deletions(-) create mode 100644 packages/forge/blocks/anthropic/schemas.ts create mode 100644 packages/forge/blocks/calCom/schemas.ts create mode 100644 packages/forge/blocks/chatNode/schemas.ts create mode 100644 packages/forge/blocks/difyAi/schemas.ts create mode 100644 packages/forge/blocks/elevenlabs/schemas.ts create mode 100644 packages/forge/blocks/mistral/schemas.ts create mode 100644 packages/forge/blocks/openRouter/schemas.ts create mode 100644 packages/forge/blocks/openai/schemas.ts create mode 100644 packages/forge/blocks/qrcode/schemas.ts create mode 100644 packages/forge/blocks/togetherAi/schemas.ts create mode 100644 packages/forge/blocks/zemanticAi/schemas.ts rename packages/forge/repository/{index.ts => constants.ts} (58%) create mode 100644 packages/forge/repository/credentials.ts create mode 100644 packages/forge/repository/definitions.ts create mode 100644 packages/forge/repository/schemas.ts create mode 100644 packages/forge/repository/types.ts delete mode 100644 packages/forge/schemas/index.ts delete mode 100644 packages/forge/schemas/package.json create mode 100644 packages/schemas/features/blocks/forged/helpers.ts create mode 100644 packages/variables/types.ts diff --git a/apps/builder/package.json b/apps/builder/package.json index 2dd57074f..537beb159 100644 --- a/apps/builder/package.json +++ b/apps/builder/package.json @@ -99,7 +99,6 @@ "@playwright/test": "1.41.2", "@typebot.io/forge": "workspace:*", "@typebot.io/forge-repository": "workspace:*", - "@typebot.io/forge-schemas": "workspace:*", "@typebot.io/lib": "workspace:*", "@typebot.io/prisma": "workspace:*", "@typebot.io/radar": "workspace:*", diff --git a/apps/builder/src/features/editor/components/BlockCard.tsx b/apps/builder/src/features/editor/components/BlockCard.tsx index 7f696bb74..4db3abb1c 100644 --- a/apps/builder/src/features/editor/components/BlockCard.tsx +++ b/apps/builder/src/features/editor/components/BlockCard.tsx @@ -12,9 +12,9 @@ import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/const import { IntegrationBlockType } from '@typebot.io/schemas/features/blocks/integrations/constants' import { LogicBlockType } from '@typebot.io/schemas/features/blocks/logic/constants' import { BlockV6 } from '@typebot.io/schemas' -import { enabledBlocks } from '@typebot.io/forge-repository' import { BlockCardLayout } from './BlockCardLayout' import { ForgedBlockCard } from '@/features/forge/ForgedBlockCard' +import { isForgedBlockType } from '@typebot.io/schemas/features/blocks/forged/helpers' type Props = { type: BlockV6['type'] @@ -30,13 +30,8 @@ export const BlockCard = ( const { t } = useTranslate() const { workspace } = useWorkspace() - if (enabledBlocks.includes(props.type as (typeof enabledBlocks)[number])) { - return ( - - ) + if (isForgedBlockType(props.type)) { + return } switch (props.type) { case BubbleBlockType.EMBED: diff --git a/apps/builder/src/features/editor/components/BlocksSideBar.tsx b/apps/builder/src/features/editor/components/BlocksSideBar.tsx index 12f747a6d..41e20a5d5 100644 --- a/apps/builder/src/features/editor/components/BlocksSideBar.tsx +++ b/apps/builder/src/features/editor/components/BlocksSideBar.tsx @@ -23,8 +23,8 @@ import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/const import { IntegrationBlockType } from '@typebot.io/schemas/features/blocks/integrations/constants' import { LogicBlockType } from '@typebot.io/schemas/features/blocks/logic/constants' import { BlockV6 } from '@typebot.io/schemas' -import { enabledBlocks } from '@typebot.io/forge-repository' import { useDebouncedCallback } from 'use-debounce' +import { forgedBlockIds } from '@typebot.io/forge-repository/constants' // Integration blocks migrated to forged blocks const legacyIntegrationBlocks = [ @@ -174,7 +174,7 @@ export const BlocksSideBar = () => { {Object.values(IntegrationBlockType) - .concat(enabledBlocks as any) + .concat(forgedBlockIds as any) .filter((type) => !legacyIntegrationBlocks.includes(type)) .map((type) => ( i.pick(inputShape)) + Object.values(forgedCredentialsSchemas) + .filter(isDefined) + .map((i) => i.pick(inputShape)) ), }) ) diff --git a/apps/builder/src/features/forge/api/credentials/listCredentials.ts b/apps/builder/src/features/forge/api/credentials/listCredentials.ts index a89598bef..7d5b0011d 100644 --- a/apps/builder/src/features/forge/api/credentials/listCredentials.ts +++ b/apps/builder/src/features/forge/api/credentials/listCredentials.ts @@ -3,13 +3,13 @@ import { authenticatedProcedure } from '@/helpers/server/trpc' import { TRPCError } from '@trpc/server' import { z } from 'zod' import { isReadWorkspaceFobidden } from '@/features/workspace/helpers/isReadWorkspaceFobidden' -import { enabledBlocks } from '@typebot.io/forge-repository' +import { forgedBlockIds } from '@typebot.io/forge-repository/constants' export const listCredentials = authenticatedProcedure .input( z.object({ workspaceId: z.string(), - type: z.enum(enabledBlocks), + type: z.enum(forgedBlockIds), }) ) .query(async ({ input: { workspaceId, type }, ctx: { user } }) => { diff --git a/apps/builder/src/features/forge/api/fetchSelectItems.ts b/apps/builder/src/features/forge/api/fetchSelectItems.ts index 45f91b7ee..ded2756de 100644 --- a/apps/builder/src/features/forge/api/fetchSelectItems.ts +++ b/apps/builder/src/features/forge/api/fetchSelectItems.ts @@ -3,13 +3,14 @@ import { authenticatedProcedure } from '@/helpers/server/trpc' import { TRPCError } from '@trpc/server' import { z } from 'zod' import { isReadWorkspaceFobidden } from '@/features/workspace/helpers/isReadWorkspaceFobidden' -import { forgedBlocks } from '@typebot.io/forge-schemas' +import { forgedBlocks } from '@typebot.io/forge-repository/definitions' +import { forgedBlockIds } from '@typebot.io/forge-repository/constants' import { decrypt } from '@typebot.io/lib/api/encryption/decrypt' export const fetchSelectItems = authenticatedProcedure .input( z.object({ - integrationId: z.string(), + integrationId: z.enum(forgedBlockIds), fetcherId: z.string(), options: z.any(), workspaceId: z.string(), @@ -55,7 +56,7 @@ export const fetchSelectItems = authenticatedProcedure const credentialsData = await decrypt(credentials.data, credentials.iv) - const blockDef = forgedBlocks.find((b) => b.id === integrationId) + const blockDef = forgedBlocks[integrationId] const fetchers = (blockDef?.fetchers ?? []).concat( blockDef?.actions.flatMap((action) => action.fetchers ?? []) ?? [] diff --git a/apps/builder/src/features/forge/components/ForgeSelectInput.tsx b/apps/builder/src/features/forge/components/ForgeSelectInput.tsx index c446ab254..d0b94aa15 100644 --- a/apps/builder/src/features/forge/components/ForgeSelectInput.tsx +++ b/apps/builder/src/features/forge/components/ForgeSelectInput.tsx @@ -11,7 +11,10 @@ import { HStack, Stack, } from '@chakra-ui/react' -import { ForgedBlockDefinition, ForgedBlock } from '@typebot.io/forge-schemas' +import { + ForgedBlockDefinition, + ForgedBlock, +} from '@typebot.io/forge-repository/types' import { ReactNode, useMemo } from 'react' type Props = { diff --git a/apps/builder/src/features/forge/components/ForgedBlockNodeContent.tsx b/apps/builder/src/features/forge/components/ForgedBlockNodeContent.tsx index c54cae7f6..f12678e72 100644 --- a/apps/builder/src/features/forge/components/ForgedBlockNodeContent.tsx +++ b/apps/builder/src/features/forge/components/ForgedBlockNodeContent.tsx @@ -2,7 +2,7 @@ import { SetVariableLabel } from '@/components/SetVariableLabel' import { useTypebot } from '@/features/editor/providers/TypebotProvider' import { Stack, Text } from '@chakra-ui/react' import { useForgedBlock } from '../hooks/useForgedBlock' -import { ForgedBlock } from '@typebot.io/forge-schemas' +import { ForgedBlock } from '@typebot.io/forge-repository/types' type Props = { block: ForgedBlock diff --git a/apps/builder/src/features/forge/components/ForgedBlockSettings.tsx b/apps/builder/src/features/forge/components/ForgedBlockSettings.tsx index f30b2505c..26c79f026 100644 --- a/apps/builder/src/features/forge/components/ForgedBlockSettings.tsx +++ b/apps/builder/src/features/forge/components/ForgedBlockSettings.tsx @@ -5,7 +5,7 @@ import { ForgedCredentialsModal } from './credentials/ForgedCredentialsModal' import { ZodObjectLayout } from './zodLayouts/ZodObjectLayout' import { ZodActionDiscriminatedUnion } from './zodLayouts/ZodActionDiscriminatedUnion' import { useForgedBlock } from '../hooks/useForgedBlock' -import { ForgedBlock } from '@typebot.io/forge-schemas' +import { ForgedBlock } from '@typebot.io/forge-repository/types' type Props = { block: ForgedBlock diff --git a/apps/builder/src/features/forge/components/ForgedBlockTurnIntoMenu.tsx b/apps/builder/src/features/forge/components/ForgedBlockTurnIntoMenu.tsx index d7be84cae..bda0552b9 100644 --- a/apps/builder/src/features/forge/components/ForgedBlockTurnIntoMenu.tsx +++ b/apps/builder/src/features/forge/components/ForgedBlockTurnIntoMenu.tsx @@ -11,7 +11,7 @@ import { RepeatIcon, ChevronRightIcon } from '@/components/icons' import { useDebouncedCallback } from 'use-debounce' import { useForgedBlock } from '@/features/forge/hooks/useForgedBlock' import { ForgedBlockIcon } from '@/features/forge/ForgedBlockIcon' -import { ForgedBlock } from '@typebot.io/forge-schemas' +import { ForgedBlock } from '@typebot.io/forge-repository/types' import { TurnableIntoParam } from '@typebot.io/forge' import { ZodObject } from 'zod' import { BlockV6 } from '@typebot.io/schemas' @@ -64,8 +64,8 @@ export const ForgedBlockTurnIntoMenu = ({ block, onTurnIntoClick }: Props) => { > {actionDef.turnableInto.map((params) => ( onTurnIntoClick(params, blockSchema)} /> ))} diff --git a/apps/builder/src/features/forge/components/credentials/ForgedCredentialsDropdown.tsx b/apps/builder/src/features/forge/components/credentials/ForgedCredentialsDropdown.tsx index 4786e1e6a..32abaf5a4 100644 --- a/apps/builder/src/features/forge/components/credentials/ForgedCredentialsDropdown.tsx +++ b/apps/builder/src/features/forge/components/credentials/ForgedCredentialsDropdown.tsx @@ -14,7 +14,7 @@ import React, { useCallback, useEffect, useState } from 'react' import { useRouter } from 'next/router' import { trpc } from '@/lib/trpc' import { useWorkspace } from '@/features/workspace/WorkspaceProvider' -import { ForgedBlockDefinition } from '@typebot.io/forge-schemas' +import { ForgedBlockDefinition } from '@typebot.io/forge-repository/types' import { useToast } from '@/hooks/useToast' type Props = Omit & { @@ -109,7 +109,7 @@ export const ForgedCredentialsDropdown = ({ isLoading={isLoading} {...props} > - Add {blockDef.auth.name} + Add {blockDef.auth?.name} ) } @@ -130,7 +130,7 @@ export const ForgedCredentialsDropdown = ({ > {currentCredential ? currentCredential.name - : `Select ${blockDef.auth.name}`} + : `Select ${blockDef.auth?.name}`} diff --git a/apps/builder/src/features/forge/components/credentials/ForgedCredentialsModal.tsx b/apps/builder/src/features/forge/components/credentials/ForgedCredentialsModal.tsx index 2e260d8ed..bc847aea1 100644 --- a/apps/builder/src/features/forge/components/credentials/ForgedCredentialsModal.tsx +++ b/apps/builder/src/features/forge/components/credentials/ForgedCredentialsModal.tsx @@ -15,7 +15,7 @@ import { } from '@chakra-ui/react' import React, { useState } from 'react' import { ZodObjectLayout } from '../zodLayouts/ZodObjectLayout' -import { ForgedBlockDefinition } from '@typebot.io/forge-schemas' +import { ForgedBlockDefinition } from '@typebot.io/forge-repository/types' type Props = { blockDef: ForgedBlockDefinition diff --git a/apps/builder/src/features/forge/components/zodLayouts/ZodActionDiscriminatedUnion.tsx b/apps/builder/src/features/forge/components/zodLayouts/ZodActionDiscriminatedUnion.tsx index 72db286e4..54c0c4fdb 100644 --- a/apps/builder/src/features/forge/components/zodLayouts/ZodActionDiscriminatedUnion.tsx +++ b/apps/builder/src/features/forge/components/zodLayouts/ZodActionDiscriminatedUnion.tsx @@ -4,7 +4,10 @@ import { z } from '@typebot.io/forge/zod' import { useMemo } from 'react' import { ZodObjectLayout } from './ZodObjectLayout' import { isDefined } from '@typebot.io/lib' -import { ForgedBlockDefinition, ForgedBlock } from '@typebot.io/forge-schemas' +import { + ForgedBlockDefinition, + ForgedBlock, +} from '@typebot.io/forge-repository/types' type Props = { blockDef?: ForgedBlockDefinition diff --git a/apps/builder/src/features/forge/components/zodLayouts/ZodDiscriminatedUnionLayout.tsx b/apps/builder/src/features/forge/components/zodLayouts/ZodDiscriminatedUnionLayout.tsx index bc426db5f..44e7e627b 100644 --- a/apps/builder/src/features/forge/components/zodLayouts/ZodDiscriminatedUnionLayout.tsx +++ b/apps/builder/src/features/forge/components/zodLayouts/ZodDiscriminatedUnionLayout.tsx @@ -2,7 +2,10 @@ import { DropdownList } from '@/components/DropdownList' import { z } from '@typebot.io/forge/zod' import { ZodObjectLayout } from './ZodObjectLayout' import { isDefined } from '@typebot.io/lib' -import { ForgedBlockDefinition, ForgedBlock } from '@typebot.io/forge-schemas' +import { + ForgedBlockDefinition, + ForgedBlock, +} from '@typebot.io/forge-repository/types' /* eslint-disable @typescript-eslint/no-explicit-any */ export const ZodDiscriminatedUnionLayout = ({ diff --git a/apps/builder/src/features/forge/components/zodLayouts/ZodFieldLayout.tsx b/apps/builder/src/features/forge/components/zodLayouts/ZodFieldLayout.tsx index 61cbc98fc..f4065db99 100644 --- a/apps/builder/src/features/forge/components/zodLayouts/ZodFieldLayout.tsx +++ b/apps/builder/src/features/forge/components/zodLayouts/ZodFieldLayout.tsx @@ -19,7 +19,10 @@ import { } from '@chakra-ui/react' import { VariableSearchInput } from '@/components/inputs/VariableSearchInput' import { DropdownList } from '@/components/DropdownList' -import { ForgedBlockDefinition, ForgedBlock } from '@typebot.io/forge-schemas' +import { + ForgedBlockDefinition, + ForgedBlock, +} from '@typebot.io/forge-repository/types' import { PrimitiveList } from '@/components/PrimitiveList' import { SwitchWithLabel } from '@/components/inputs/SwitchWithLabel' import { CodeEditor } from '@/components/inputs/CodeEditor' diff --git a/apps/builder/src/features/forge/components/zodLayouts/ZodObjectLayout.tsx b/apps/builder/src/features/forge/components/zodLayouts/ZodObjectLayout.tsx index bcff3ce00..8def0d2ac 100644 --- a/apps/builder/src/features/forge/components/zodLayouts/ZodObjectLayout.tsx +++ b/apps/builder/src/features/forge/components/zodLayouts/ZodObjectLayout.tsx @@ -14,7 +14,10 @@ import { ZodLayoutMetadata } from '@typebot.io/forge/zod' import { ReactNode } from 'react' import { ZodTypeAny } from 'zod' import { ZodFieldLayout } from './ZodFieldLayout' -import { ForgedBlockDefinition, ForgedBlock } from '@typebot.io/forge-schemas' +import { + ForgedBlockDefinition, + ForgedBlock, +} from '@typebot.io/forge-repository/types' import { getZodInnerSchema } from '../../helpers/getZodInnerSchema' export const ZodObjectLayout = ({ diff --git a/apps/builder/src/features/forge/hooks/useForgedBlock.ts b/apps/builder/src/features/forge/hooks/useForgedBlock.ts index 14edc33f2..73b199f1c 100644 --- a/apps/builder/src/features/forge/hooks/useForgedBlock.ts +++ b/apps/builder/src/features/forge/hooks/useForgedBlock.ts @@ -1,22 +1,16 @@ import { useMemo } from 'react' -import { forgedBlockSchemas, forgedBlocks } from '@typebot.io/forge-schemas' -import { enabledBlocks } from '@typebot.io/forge-repository' +import { forgedBlocks } from '@typebot.io/forge-repository/definitions' +import { forgedBlockSchemas } from '@typebot.io/forge-repository/schemas' import { BlockV6 } from '@typebot.io/schemas' +import { isForgedBlockType } from '@typebot.io/schemas/features/blocks/forged/helpers' export const useForgedBlock = (blockType: BlockV6['type'], action?: string) => useMemo(() => { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - if ((enabledBlocks as any).includes(blockType) === false) return {} - const blockDef = forgedBlocks.find( - (b) => enabledBlocks.includes(b.id) && b.id === blockType - ) + if (!isForgedBlockType(blockType)) return {} + const blockDef = forgedBlocks[blockType] return { blockDef, - blockSchema: forgedBlockSchemas.find( - (b) => - enabledBlocks.includes(b.shape.type.value) && - b.shape.type.value === blockType - ), + blockSchema: forgedBlockSchemas[blockType], actionDef: action ? blockDef?.actions.find((a) => a.name === action) : undefined, diff --git a/apps/builder/src/features/graph/components/nodes/block/BlockNode.tsx b/apps/builder/src/features/graph/components/nodes/block/BlockNode.tsx index c487fcb29..25655a63e 100644 --- a/apps/builder/src/features/graph/components/nodes/block/BlockNode.tsx +++ b/apps/builder/src/features/graph/components/nodes/block/BlockNode.tsx @@ -194,7 +194,7 @@ export const BlockNode = ({ indices, targetBlockSchema.parse({ ...block, - type: turnIntoParams.blockType, + type: turnIntoParams.blockId, options: { ...convertedBlockOptions, credentialsId: undefined, diff --git a/apps/builder/src/features/graph/helpers/getHelpDocUrl.ts b/apps/builder/src/features/graph/helpers/getHelpDocUrl.ts index 66e0efe12..f24221a08 100644 --- a/apps/builder/src/features/graph/helpers/getHelpDocUrl.ts +++ b/apps/builder/src/features/graph/helpers/getHelpDocUrl.ts @@ -1,4 +1,4 @@ -import { ForgedBlockDefinition } from '@typebot.io/forge-schemas' +import { ForgedBlockDefinition } from '@typebot.io/forge-repository/types' import { BlockWithOptions } from '@typebot.io/schemas' import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants' import { IntegrationBlockType } from '@typebot.io/schemas/features/blocks/integrations/constants' diff --git a/apps/builder/src/features/typebot/helpers/sanitizers.ts b/apps/builder/src/features/typebot/helpers/sanitizers.ts index 431fd90b3..4d27f7058 100644 --- a/apps/builder/src/features/typebot/helpers/sanitizers.ts +++ b/apps/builder/src/features/typebot/helpers/sanitizers.ts @@ -1,5 +1,3 @@ -import { forgedBlockSchemas } from '@typebot.io/forge-schemas' -import { enabledBlocks } from '@typebot.io/forge-repository' import prisma from '@typebot.io/lib/prisma' import { Plan } from '@typebot.io/prisma' import { Block, Typebot } from '@typebot.io/schemas' @@ -51,25 +49,6 @@ const sanitizeBlock = async (block: Block): Promise => { if (!('options' in block) || !block.options) return block - if (enabledBlocks.includes(block.type as (typeof enabledBlocks)[number])) { - const schema = forgedBlockSchemas.find( - (s) => s.shape.type.value === block.type - ) - if (!schema) - throw new Error( - `Integration block schema not found for block type ${block.type}` - ) - return schema.parse({ - ...block, - options: { - ...block.options, - credentialsId: await sanitizeCredentialsId(workspaceId)( - block.options.credentialsId - ), - }, - }) - } - if (!('credentialsId' in block.options) || !block.options.credentialsId) return block diff --git a/apps/docs/openapi/builder.json b/apps/docs/openapi/builder.json index cdc4f3cac..48b1e8e5b 100644 --- a/apps/docs/openapi/builder.json +++ b/apps/docs/openapi/builder.json @@ -16512,2311 +16512,3825 @@ "title": "Group V6" }, "block": { - "anyOf": [ + "oneOf": [ { - "oneOf": [ - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "text" - ] - }, - "content": { - "type": "object", - "properties": { - "html": { - "type": "string" - }, - "richText": { - "type": "array", - "items": {} - }, - "plainText": { - "type": "string" - } - } - } - }, - "required": [ - "id", - "type" + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "text" ] }, - { + "content": { "type": "object", "properties": { - "id": { + "html": { "type": "string" }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "image" - ] - }, - "content": { - "type": "object", - "properties": { - "url": { - "type": "string" - }, - "clickLink": { - "type": "object", - "properties": { - "url": { - "type": "string" - }, - "alt": { - "type": "string" - } - } - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "video" - ] - }, - "content": { - "type": "object", - "properties": { - "url": { - "type": "string" - }, - "id": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "url", - "youtube", - "vimeo", - "tiktok", - "gumlet" - ] - }, - "height": { - "anyOf": [ - { - "type": "number" - }, - {} - ] - }, - "aspectRatio": { - "type": "string" - }, - "maxWidth": { - "type": "string" - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "embed" - ] - }, - "content": { - "type": "object", - "properties": { - "url": { - "type": "string" - }, - "height": { - "anyOf": [ - { - "type": "number" - }, - {} - ] - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "audio" - ] - }, - "content": { - "type": "object", - "properties": { - "url": { - "type": "string" - }, - "isAutoplayEnabled": { - "type": "boolean" - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "$ref": "#/components/schemas/textInput" - }, - { - "$ref": "#/components/schemas/buttonsInput" - }, - { - "$ref": "#/components/schemas/email" - }, - { - "$ref": "#/components/schemas/numberInput" - }, - { - "$ref": "#/components/schemas/url" - }, - { - "$ref": "#/components/schemas/phoneNumberInput" - }, - { - "$ref": "#/components/schemas/dateInput" - }, - { - "$ref": "#/components/schemas/paymentInput" - }, - { - "$ref": "#/components/schemas/rating" - }, - { - "$ref": "#/components/schemas/fileInput" - }, - { - "$ref": "#/components/schemas/pictureChoice" - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Code" - ] - }, - "options": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "content": { - "type": "string" - }, - "isExecutedOnClient": { - "type": "boolean" - }, - "shouldExecuteInParentContext": { - "type": "boolean" - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Condition" - ] - }, - "items": { + "richText": { "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "content": { - "type": "object", - "properties": { - "logicalOperator": { - "type": "string", - "enum": [ - "OR", - "AND" - ] - }, - "comparisons": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "variableId": { - "type": "string" - }, - "comparisonOperator": { - "type": "string", - "enum": [ - "Equal to", - "Not equal", - "Contains", - "Does not contain", - "Greater than", - "Less than", - "Is set", - "Is empty", - "Starts with", - "Ends with", - "Matches regex", - "Does not match regex" - ] - }, - "value": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - } - } - } - }, - "required": [ - "id" - ] - } + "items": {} + }, + "plainText": { + "type": "string" } - }, - "required": [ - "id", - "type", - "items" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Redirect" - ] - }, - "options": { - "type": "object", - "properties": { - "url": { - "type": "string" - }, - "isNewTab": { - "type": "boolean" - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Set variable" - ] - }, - "options": { - "oneOf": [ - { - "type": "object", - "properties": { - "variableId": { - "type": "string" - }, - "isExecutedOnClient": { - "type": "boolean" - }, - "expressionToEvaluate": { - "type": "string" - }, - "isCode": { - "type": "boolean" - } - } - }, - { - "type": "object", - "properties": { - "variableId": { - "type": "string" - }, - "isExecutedOnClient": { - "type": "boolean" - }, - "type": { - "type": "string", - "enum": [ - "Now", - "Yesterday", - "Tomorrow" - ] - }, - "timeZone": { - "type": "string" - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "variableId": { - "type": "string" - }, - "isExecutedOnClient": { - "type": "boolean" - }, - "type": { - "type": "string", - "enum": [ - "Today", - "Moment of the day", - "Empty", - "Environment name", - "User ID", - "Result ID", - "Random ID", - "Phone number", - "Contact name" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "variableId": { - "type": "string" - }, - "isExecutedOnClient": { - "type": "boolean" - }, - "type": { - "type": "string", - "enum": [ - "Custom" - ] - }, - "expressionToEvaluate": { - "type": "string" - }, - "isCode": { - "type": "boolean" - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "variableId": { - "type": "string" - }, - "isExecutedOnClient": { - "type": "boolean" - }, - "type": { - "type": "string", - "enum": [ - "Map item with same index" - ] - }, - "mapListItemParams": { - "type": "object", - "properties": { - "baseItemVariableId": { - "type": "string" - }, - "baseListVariableId": { - "type": "string" - }, - "targetListVariableId": { - "type": "string" - } - } - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "variableId": { - "type": "string" - }, - "isExecutedOnClient": { - "type": "boolean" - }, - "type": { - "type": "string", - "enum": [ - "Append value(s)" - ] - }, - "item": { - "type": "string" - } - }, - "required": [ - "type" - ] - } - ] - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Typebot link" - ] - }, - "options": { - "type": "object", - "properties": { - "typebotId": { - "type": "string" - }, - "groupId": { - "type": "string" - }, - "mergeResults": { - "type": "boolean" - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Wait" - ] - }, - "options": { - "type": "object", - "properties": { - "secondsToWaitFor": { - "type": "string" - }, - "shouldPause": { - "type": "boolean" - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Jump" - ] - }, - "options": { - "type": "object", - "properties": { - "groupId": { - "type": "string" - }, - "blockId": { - "type": "string" - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "AB test" - ] - }, - "items": { - "type": "array", - "maxItems": 2, - "minItems": 2, - "items": { - "oneOf": [ - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "path": { - "type": "string", - "enum": [ - "a" - ] - } - }, - "required": [ - "id", - "path" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "path": { - "type": "string", - "enum": [ - "b" - ] - } - }, - "required": [ - "id", - "path" - ] - } - ] - } - }, - "options": { - "type": "object", - "properties": { - "aPercent": { - "type": "number", - "minimum": 0, - "maximum": 100 - } - } - } - }, - "required": [ - "id", - "type", - "items" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Chatwoot" - ] - }, - "options": { - "type": "object", - "properties": { - "task": { - "type": "string", - "enum": [ - "Show widget", - "Close widget" - ] - }, - "baseUrl": { - "type": "string" - }, - "websiteToken": { - "type": "string" - }, - "user": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "email": { - "type": "string" - }, - "name": { - "type": "string" - }, - "avatarUrl": { - "type": "string" - }, - "phoneNumber": { - "type": "string" - } - } - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Google Analytics" - ] - }, - "options": { - "type": "object", - "properties": { - "trackingId": { - "type": "string" - }, - "category": { - "type": "string" - }, - "action": { - "type": "string" - }, - "label": { - "type": "string" - }, - "value": { - "anyOf": [ - { - "type": "number" - }, - {} - ] - }, - "sendTo": { - "type": "string" - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Google Sheets" - ] - }, - "options": { - "oneOf": [ - { - "type": "object", - "properties": { - "credentialsId": { - "type": "string" - }, - "sheetId": { - "type": "string" - }, - "spreadsheetId": { - "type": "string" - }, - "action": { - "type": "string", - "enum": [ - "Get data from sheet" - ] - }, - "filter": { - "type": "object", - "properties": { - "comparisons": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "column": { - "type": "string" - }, - "comparisonOperator": { - "type": "string", - "enum": [ - "Equal to", - "Not equal", - "Contains", - "Does not contain", - "Greater than", - "Less than", - "Is set", - "Is empty", - "Starts with", - "Ends with", - "Matches regex", - "Does not match regex" - ] - }, - "value": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "logicalOperator": { - "type": "string", - "enum": [ - "OR", - "AND" - ] - } - } - }, - "cellsToExtract": { - "type": "array", - "items": { - "type": "object", - "properties": { - "column": { - "type": "string" - }, - "id": { - "type": "string" - }, - "variableId": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "totalRowsToExtract": { - "type": "string", - "enum": [ - "All", - "First", - "Last", - "Random" - ] - } - }, - "required": [ - "action" - ] - }, - { - "type": "object", - "properties": { - "credentialsId": { - "type": "string" - }, - "sheetId": { - "type": "string" - }, - "spreadsheetId": { - "type": "string" - }, - "action": { - "type": "string", - "enum": [ - "Insert a row" - ] - }, - "cellsToInsert": { - "type": "array", - "items": { - "type": "object", - "properties": { - "column": { - "type": "string" - }, - "value": { - "type": "string" - }, - "id": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - } - }, - "required": [ - "action" - ] - }, - { - "type": "object", - "properties": { - "credentialsId": { - "type": "string" - }, - "sheetId": { - "type": "string" - }, - "spreadsheetId": { - "type": "string" - }, - "action": { - "type": "string", - "enum": [ - "Update a row" - ] - }, - "cellsToUpsert": { - "type": "array", - "items": { - "type": "object", - "properties": { - "column": { - "type": "string" - }, - "value": { - "type": "string" - }, - "id": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "filter": { - "type": "object", - "properties": { - "comparisons": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "column": { - "type": "string" - }, - "comparisonOperator": { - "type": "string", - "enum": [ - "Equal to", - "Not equal", - "Contains", - "Does not contain", - "Greater than", - "Less than", - "Is set", - "Is empty", - "Starts with", - "Ends with", - "Matches regex", - "Does not match regex" - ] - }, - "value": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "logicalOperator": { - "type": "string", - "enum": [ - "OR", - "AND" - ] - } - } - } - }, - "required": [ - "action" - ] - }, - { - "type": "object", - "properties": { - "credentialsId": { - "type": "string" - }, - "sheetId": { - "type": "string" - }, - "spreadsheetId": { - "type": "string" - } - } - } - ] - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Make.com" - ] - }, - "options": { - "type": "object", - "properties": { - "variablesForTest": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "variableId": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "responseVariableMapping": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "variableId": { - "type": "string" - }, - "bodyPath": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "isAdvancedConfig": { - "type": "boolean" - }, - "isCustomBody": { - "type": "boolean" - }, - "isExecutedOnClient": { - "type": "boolean" - }, - "webhook": { - "type": "object", - "properties": { - "queryParams": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "headers": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "method": { - "type": "string", - "enum": [ - "POST", - "GET", - "PUT", - "DELETE", - "PATCH", - "HEAD", - "CONNECT", - "OPTIONS", - "TRACE" - ] - }, - "url": { - "type": "string" - }, - "body": { - "type": "string" - } - } - }, - "timeout": { - "type": "number", - "minimum": 1, - "maximum": 120 - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "OpenAI" - ] - }, - "options": { - "oneOf": [ - { - "type": "object", - "properties": { - "credentialsId": { - "type": "string" - }, - "baseUrl": { - "type": "string" - }, - "apiVersion": { - "type": "string" - } - } - }, - { - "type": "object", - "properties": { - "task": { - "type": "string", - "enum": [ - "Create chat completion" - ] - }, - "model": { - "type": "string" - }, - "messages": { - "type": "array", - "items": { - "anyOf": [ - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "role": { - "type": "string", - "enum": [ - "system", - "user", - "assistant" - ] - }, - "content": { - "type": "string" - }, - "name": { - "type": "string" - } - }, - "required": [ - "id" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "role": { - "type": "string", - "enum": [ - "Messages sequence ✨" - ] - }, - "content": { - "type": "object", - "properties": { - "assistantMessagesVariableId": { - "type": "string" - }, - "userMessagesVariableId": { - "type": "string" - } - } - } - }, - "required": [ - "id", - "role" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "role": { - "type": "string", - "enum": [ - "Dialogue" - ] - }, - "dialogueVariableId": { - "type": "string" - }, - "startsBy": { - "type": "string", - "enum": [ - "user", - "assistant" - ] - } - }, - "required": [ - "id", - "role" - ] - } - ] - } - }, - "advancedSettings": { - "type": "object", - "properties": { - "temperature": { - "anyOf": [ - { - "type": "number" - }, - {} - ] - } - } - }, - "responseMapping": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "valueToExtract": { - "type": "string", - "enum": [ - "Message content", - "Total tokens" - ] - }, - "variableId": { - "type": "string" - } - }, - "required": [ - "id", - "valueToExtract" - ] - } - }, - "credentialsId": { - "type": "string" - }, - "baseUrl": { - "type": "string" - }, - "apiVersion": { - "type": "string" - } - }, - "required": [ - "task" - ] - }, - { - "type": "object", - "properties": { - "task": { - "type": "string", - "enum": [ - "Create image" - ] - }, - "prompt": { - "type": "string" - }, - "advancedOptions": { - "type": "object", - "properties": { - "size": { - "type": "string", - "enum": [ - "256x256", - "512x512", - "1024x1024" - ] - } - } - }, - "responseMapping": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "valueToExtract": { - "type": "string", - "enum": [ - "Image URL" - ] - }, - "variableId": { - "type": "string" - } - }, - "required": [ - "id", - "valueToExtract" - ] - } - }, - "credentialsId": { - "type": "string" - }, - "baseUrl": { - "type": "string" - }, - "apiVersion": { - "type": "string" - } - }, - "required": [ - "task", - "advancedOptions", - "responseMapping" - ] - }, - { - "type": "object", - "properties": { - "credentialsId": { - "type": "string" - }, - "baseUrl": { - "type": "string" - }, - "apiVersion": { - "type": "string" - }, - "task": { - "type": "string", - "enum": [ - "Create speech" - ] - }, - "model": { - "type": "string" - }, - "input": { - "type": "string" - }, - "voice": { - "type": "string", - "enum": [ - "alloy", - "echo", - "fable", - "onyx", - "nova", - "shimmer" - ] - }, - "saveUrlInVariableId": { - "type": "string" - } - }, - "required": [ - "task" - ] - } - ] - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Pabbly" - ] - }, - "options": { - "type": "object", - "properties": { - "variablesForTest": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "variableId": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "responseVariableMapping": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "variableId": { - "type": "string" - }, - "bodyPath": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "isAdvancedConfig": { - "type": "boolean" - }, - "isCustomBody": { - "type": "boolean" - }, - "isExecutedOnClient": { - "type": "boolean" - }, - "webhook": { - "type": "object", - "properties": { - "queryParams": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "headers": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "method": { - "type": "string", - "enum": [ - "POST", - "GET", - "PUT", - "DELETE", - "PATCH", - "HEAD", - "CONNECT", - "OPTIONS", - "TRACE" - ] - }, - "url": { - "type": "string" - }, - "body": { - "type": "string" - } - } - }, - "timeout": { - "type": "number", - "minimum": 1, - "maximum": 120 - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Email" - ] - }, - "options": { - "type": "object", - "properties": { - "credentialsId": { - "type": "string" - }, - "isCustomBody": { - "type": "boolean" - }, - "isBodyCode": { - "type": "boolean" - }, - "recipients": { - "type": "array", - "items": { - "type": "string" - } - }, - "subject": { - "type": "string" - }, - "body": { - "type": "string" - }, - "replyTo": { - "type": "string" - }, - "cc": { - "type": "array", - "items": { - "type": "string" - } - }, - "bcc": { - "type": "array", - "items": { - "type": "string" - } - }, - "attachmentsVariableId": { - "type": "string" - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Webhook" - ], - "description": "Legacy name for HTTP Request block" - }, - "options": { - "type": "object", - "properties": { - "variablesForTest": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "variableId": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "responseVariableMapping": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "variableId": { - "type": "string" - }, - "bodyPath": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "isAdvancedConfig": { - "type": "boolean" - }, - "isCustomBody": { - "type": "boolean" - }, - "isExecutedOnClient": { - "type": "boolean" - }, - "webhook": { - "type": "object", - "properties": { - "queryParams": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "headers": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "method": { - "type": "string", - "enum": [ - "POST", - "GET", - "PUT", - "DELETE", - "PATCH", - "HEAD", - "CONNECT", - "OPTIONS", - "TRACE" - ] - }, - "url": { - "type": "string" - }, - "body": { - "type": "string" - } - } - }, - "timeout": { - "type": "number", - "minimum": 1, - "maximum": 120 - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Zapier" - ] - }, - "options": { - "type": "object", - "properties": { - "variablesForTest": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "variableId": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "responseVariableMapping": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "variableId": { - "type": "string" - }, - "bodyPath": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "isAdvancedConfig": { - "type": "boolean" - }, - "isCustomBody": { - "type": "boolean" - }, - "isExecutedOnClient": { - "type": "boolean" - }, - "webhook": { - "type": "object", - "properties": { - "queryParams": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "headers": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "method": { - "type": "string", - "enum": [ - "POST", - "GET", - "PUT", - "DELETE", - "PATCH", - "HEAD", - "CONNECT", - "OPTIONS", - "TRACE" - ] - }, - "url": { - "type": "string" - }, - "body": { - "type": "string" - } - } - }, - "timeout": { - "type": "number", - "minimum": 1, - "maximum": 120 - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Pixel" - ] - }, - "options": { - "oneOf": [ - { - "type": "object", - "properties": { - "pixelId": { - "type": "string" - }, - "isInitSkip": { - "type": "boolean" - }, - "params": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "key": { - "type": "string" - }, - "value": {} - }, - "required": [ - "id" - ] - } - } - } - }, - { - "type": "object", - "properties": { - "pixelId": { - "type": "string" - }, - "isInitSkip": { - "type": "boolean" - }, - "params": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "key": { - "type": "string" - }, - "value": {} - }, - "required": [ - "id" - ] - } - }, - "eventType": { - "type": "string", - "enum": [ - "Lead", - "Contact", - "CompleteRegistration", - "Schedule", - "SubmitApplication", - "ViewContent", - "AddPaymentInfo", - "AddToCart", - "AddToWishlist", - "CustomizeProduct", - "Donate", - "FindLocation", - "InitiateCheckout", - "Purchase", - "Search", - "StartTrial", - "Subscribe" - ] - } - }, - "required": [ - "eventType" - ] - }, - { - "type": "object", - "properties": { - "pixelId": { - "type": "string" - }, - "isInitSkip": { - "type": "boolean" - }, - "params": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "key": { - "type": "string" - }, - "value": {} - }, - "required": [ - "id" - ] - } - }, - "eventType": { - "type": "string", - "enum": [ - "Custom" - ] - }, - "name": { - "type": "string" - } - }, - "required": [ - "eventType" - ] - } - ] - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Zemantic AI" - ] - }, - "blockId": { - "type": "string" - }, - "options": { - "type": "object", - "properties": { - "credentialsId": { - "type": "string" - }, - "projectId": { - "type": "string" - }, - "systemPrompt": { - "type": "string" - }, - "prompt": { - "type": "string" - }, - "query": { - "type": "string" - }, - "maxResults": { - "type": "integer" - }, - "responseMapping": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "valueToExtract": { - "type": "string", - "enum": [ - "Summary", - "Results" - ] - }, - "variableId": { - "type": "string" - } - }, - "required": [ - "id", - "valueToExtract" - ] - } - } - } - } - }, - "required": [ - "id", - "type" - ] + } } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "image" + ] + }, + "content": { + "type": "object", + "properties": { + "url": { + "type": "string" + }, + "clickLink": { + "type": "object", + "properties": { + "url": { + "type": "string" + }, + "alt": { + "type": "string" + } + } + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "video" + ] + }, + "content": { + "type": "object", + "properties": { + "url": { + "type": "string" + }, + "id": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "url", + "youtube", + "vimeo", + "tiktok", + "gumlet" + ] + }, + "height": { + "anyOf": [ + { + "type": "number" + }, + {} + ] + }, + "aspectRatio": { + "type": "string" + }, + "maxWidth": { + "type": "string" + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "embed" + ] + }, + "content": { + "type": "object", + "properties": { + "url": { + "type": "string" + }, + "height": { + "anyOf": [ + { + "type": "number" + }, + {} + ] + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "audio" + ] + }, + "content": { + "type": "object", + "properties": { + "url": { + "type": "string" + }, + "isAutoplayEnabled": { + "type": "boolean" + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "$ref": "#/components/schemas/textInput" + }, + { + "$ref": "#/components/schemas/buttonsInput" + }, + { + "$ref": "#/components/schemas/email" + }, + { + "$ref": "#/components/schemas/numberInput" + }, + { + "$ref": "#/components/schemas/url" + }, + { + "$ref": "#/components/schemas/phoneNumberInput" + }, + { + "$ref": "#/components/schemas/dateInput" + }, + { + "$ref": "#/components/schemas/paymentInput" + }, + { + "$ref": "#/components/schemas/rating" + }, + { + "$ref": "#/components/schemas/fileInput" + }, + { + "$ref": "#/components/schemas/pictureChoice" + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Code" + ] + }, + "options": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "content": { + "type": "string" + }, + "isExecutedOnClient": { + "type": "boolean" + }, + "shouldExecuteInParentContext": { + "type": "boolean" + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Condition" + ] + }, + "items": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "content": { + "type": "object", + "properties": { + "logicalOperator": { + "type": "string", + "enum": [ + "OR", + "AND" + ] + }, + "comparisons": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "variableId": { + "type": "string" + }, + "comparisonOperator": { + "type": "string", + "enum": [ + "Equal to", + "Not equal", + "Contains", + "Does not contain", + "Greater than", + "Less than", + "Is set", + "Is empty", + "Starts with", + "Ends with", + "Matches regex", + "Does not match regex" + ] + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + } + } + } + }, + "required": [ + "id" + ] + } + } + }, + "required": [ + "id", + "type", + "items" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Redirect" + ] + }, + "options": { + "type": "object", + "properties": { + "url": { + "type": "string" + }, + "isNewTab": { + "type": "boolean" + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Set variable" + ] + }, + "options": { + "oneOf": [ + { + "type": "object", + "properties": { + "variableId": { + "type": "string" + }, + "isExecutedOnClient": { + "type": "boolean" + }, + "expressionToEvaluate": { + "type": "string" + }, + "isCode": { + "type": "boolean" + } + } + }, + { + "type": "object", + "properties": { + "variableId": { + "type": "string" + }, + "isExecutedOnClient": { + "type": "boolean" + }, + "type": { + "type": "string", + "enum": [ + "Now", + "Yesterday", + "Tomorrow" + ] + }, + "timeZone": { + "type": "string" + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "variableId": { + "type": "string" + }, + "isExecutedOnClient": { + "type": "boolean" + }, + "type": { + "type": "string", + "enum": [ + "Today", + "Moment of the day", + "Empty", + "Environment name", + "User ID", + "Result ID", + "Random ID", + "Phone number", + "Contact name" + ] + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "variableId": { + "type": "string" + }, + "isExecutedOnClient": { + "type": "boolean" + }, + "type": { + "type": "string", + "enum": [ + "Custom" + ] + }, + "expressionToEvaluate": { + "type": "string" + }, + "isCode": { + "type": "boolean" + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "variableId": { + "type": "string" + }, + "isExecutedOnClient": { + "type": "boolean" + }, + "type": { + "type": "string", + "enum": [ + "Map item with same index" + ] + }, + "mapListItemParams": { + "type": "object", + "properties": { + "baseItemVariableId": { + "type": "string" + }, + "baseListVariableId": { + "type": "string" + }, + "targetListVariableId": { + "type": "string" + } + } + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "variableId": { + "type": "string" + }, + "isExecutedOnClient": { + "type": "boolean" + }, + "type": { + "type": "string", + "enum": [ + "Append value(s)" + ] + }, + "item": { + "type": "string" + } + }, + "required": [ + "type" + ] + } + ] + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Typebot link" + ] + }, + "options": { + "type": "object", + "properties": { + "typebotId": { + "type": "string" + }, + "groupId": { + "type": "string" + }, + "mergeResults": { + "type": "boolean" + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Wait" + ] + }, + "options": { + "type": "object", + "properties": { + "secondsToWaitFor": { + "type": "string" + }, + "shouldPause": { + "type": "boolean" + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Jump" + ] + }, + "options": { + "type": "object", + "properties": { + "groupId": { + "type": "string" + }, + "blockId": { + "type": "string" + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "AB test" + ] + }, + "items": { + "type": "array", + "maxItems": 2, + "minItems": 2, + "items": { + "oneOf": [ + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "path": { + "type": "string", + "enum": [ + "a" + ] + } + }, + "required": [ + "id", + "path" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "path": { + "type": "string", + "enum": [ + "b" + ] + } + }, + "required": [ + "id", + "path" + ] + } + ] + } + }, + "options": { + "type": "object", + "properties": { + "aPercent": { + "type": "number", + "minimum": 0, + "maximum": 100 + } + } + } + }, + "required": [ + "id", + "type", + "items" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Chatwoot" + ] + }, + "options": { + "type": "object", + "properties": { + "task": { + "type": "string", + "enum": [ + "Show widget", + "Close widget" + ] + }, + "baseUrl": { + "type": "string" + }, + "websiteToken": { + "type": "string" + }, + "user": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "email": { + "type": "string" + }, + "name": { + "type": "string" + }, + "avatarUrl": { + "type": "string" + }, + "phoneNumber": { + "type": "string" + } + } + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Google Analytics" + ] + }, + "options": { + "type": "object", + "properties": { + "trackingId": { + "type": "string" + }, + "category": { + "type": "string" + }, + "action": { + "type": "string" + }, + "label": { + "type": "string" + }, + "value": { + "anyOf": [ + { + "type": "number" + }, + {} + ] + }, + "sendTo": { + "type": "string" + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Google Sheets" + ] + }, + "options": { + "oneOf": [ + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "sheetId": { + "type": "string" + }, + "spreadsheetId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Get data from sheet" + ] + }, + "filter": { + "type": "object", + "properties": { + "comparisons": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "column": { + "type": "string" + }, + "comparisonOperator": { + "type": "string", + "enum": [ + "Equal to", + "Not equal", + "Contains", + "Does not contain", + "Greater than", + "Less than", + "Is set", + "Is empty", + "Starts with", + "Ends with", + "Matches regex", + "Does not match regex" + ] + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "logicalOperator": { + "type": "string", + "enum": [ + "OR", + "AND" + ] + } + } + }, + "cellsToExtract": { + "type": "array", + "items": { + "type": "object", + "properties": { + "column": { + "type": "string" + }, + "id": { + "type": "string" + }, + "variableId": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "totalRowsToExtract": { + "type": "string", + "enum": [ + "All", + "First", + "Last", + "Random" + ] + } + }, + "required": [ + "action" + ] + }, + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "sheetId": { + "type": "string" + }, + "spreadsheetId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Insert a row" + ] + }, + "cellsToInsert": { + "type": "array", + "items": { + "type": "object", + "properties": { + "column": { + "type": "string" + }, + "value": { + "type": "string" + }, + "id": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + } + }, + "required": [ + "action" + ] + }, + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "sheetId": { + "type": "string" + }, + "spreadsheetId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Update a row" + ] + }, + "cellsToUpsert": { + "type": "array", + "items": { + "type": "object", + "properties": { + "column": { + "type": "string" + }, + "value": { + "type": "string" + }, + "id": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "filter": { + "type": "object", + "properties": { + "comparisons": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "column": { + "type": "string" + }, + "comparisonOperator": { + "type": "string", + "enum": [ + "Equal to", + "Not equal", + "Contains", + "Does not contain", + "Greater than", + "Less than", + "Is set", + "Is empty", + "Starts with", + "Ends with", + "Matches regex", + "Does not match regex" + ] + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "logicalOperator": { + "type": "string", + "enum": [ + "OR", + "AND" + ] + } + } + } + }, + "required": [ + "action" + ] + }, + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "sheetId": { + "type": "string" + }, + "spreadsheetId": { + "type": "string" + } + } + } + ] + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Make.com" + ] + }, + "options": { + "type": "object", + "properties": { + "variablesForTest": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "variableId": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "responseVariableMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "variableId": { + "type": "string" + }, + "bodyPath": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "isAdvancedConfig": { + "type": "boolean" + }, + "isCustomBody": { + "type": "boolean" + }, + "isExecutedOnClient": { + "type": "boolean" + }, + "webhook": { + "type": "object", + "properties": { + "queryParams": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "headers": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "method": { + "type": "string", + "enum": [ + "POST", + "GET", + "PUT", + "DELETE", + "PATCH", + "HEAD", + "CONNECT", + "OPTIONS", + "TRACE" + ] + }, + "url": { + "type": "string" + }, + "body": { + "type": "string" + } + } + }, + "timeout": { + "type": "number", + "minimum": 1, + "maximum": 120 + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "OpenAI" + ] + }, + "options": { + "oneOf": [ + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "baseUrl": { + "type": "string" + }, + "apiVersion": { + "type": "string" + } + } + }, + { + "type": "object", + "properties": { + "task": { + "type": "string", + "enum": [ + "Create chat completion" + ] + }, + "model": { + "type": "string" + }, + "messages": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "role": { + "type": "string", + "enum": [ + "system", + "user", + "assistant" + ] + }, + "content": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "required": [ + "id" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "role": { + "type": "string", + "enum": [ + "Messages sequence ✨" + ] + }, + "content": { + "type": "object", + "properties": { + "assistantMessagesVariableId": { + "type": "string" + }, + "userMessagesVariableId": { + "type": "string" + } + } + } + }, + "required": [ + "id", + "role" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "role": { + "type": "string", + "enum": [ + "Dialogue" + ] + }, + "dialogueVariableId": { + "type": "string" + }, + "startsBy": { + "type": "string", + "enum": [ + "user", + "assistant" + ] + } + }, + "required": [ + "id", + "role" + ] + } + ] + } + }, + "advancedSettings": { + "type": "object", + "properties": { + "temperature": { + "anyOf": [ + { + "type": "number" + }, + {} + ] + } + } + }, + "responseMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "valueToExtract": { + "type": "string", + "enum": [ + "Message content", + "Total tokens" + ] + }, + "variableId": { + "type": "string" + } + }, + "required": [ + "id", + "valueToExtract" + ] + } + }, + "credentialsId": { + "type": "string" + }, + "baseUrl": { + "type": "string" + }, + "apiVersion": { + "type": "string" + } + }, + "required": [ + "task" + ] + }, + { + "type": "object", + "properties": { + "task": { + "type": "string", + "enum": [ + "Create image" + ] + }, + "prompt": { + "type": "string" + }, + "advancedOptions": { + "type": "object", + "properties": { + "size": { + "type": "string", + "enum": [ + "256x256", + "512x512", + "1024x1024" + ] + } + } + }, + "responseMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "valueToExtract": { + "type": "string", + "enum": [ + "Image URL" + ] + }, + "variableId": { + "type": "string" + } + }, + "required": [ + "id", + "valueToExtract" + ] + } + }, + "credentialsId": { + "type": "string" + }, + "baseUrl": { + "type": "string" + }, + "apiVersion": { + "type": "string" + } + }, + "required": [ + "task", + "advancedOptions", + "responseMapping" + ] + }, + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "baseUrl": { + "type": "string" + }, + "apiVersion": { + "type": "string" + }, + "task": { + "type": "string", + "enum": [ + "Create speech" + ] + }, + "model": { + "type": "string" + }, + "input": { + "type": "string" + }, + "voice": { + "type": "string", + "enum": [ + "alloy", + "echo", + "fable", + "onyx", + "nova", + "shimmer" + ] + }, + "saveUrlInVariableId": { + "type": "string" + } + }, + "required": [ + "task" + ] + } + ] + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Pabbly" + ] + }, + "options": { + "type": "object", + "properties": { + "variablesForTest": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "variableId": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "responseVariableMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "variableId": { + "type": "string" + }, + "bodyPath": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "isAdvancedConfig": { + "type": "boolean" + }, + "isCustomBody": { + "type": "boolean" + }, + "isExecutedOnClient": { + "type": "boolean" + }, + "webhook": { + "type": "object", + "properties": { + "queryParams": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "headers": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "method": { + "type": "string", + "enum": [ + "POST", + "GET", + "PUT", + "DELETE", + "PATCH", + "HEAD", + "CONNECT", + "OPTIONS", + "TRACE" + ] + }, + "url": { + "type": "string" + }, + "body": { + "type": "string" + } + } + }, + "timeout": { + "type": "number", + "minimum": 1, + "maximum": 120 + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Email" + ] + }, + "options": { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "isCustomBody": { + "type": "boolean" + }, + "isBodyCode": { + "type": "boolean" + }, + "recipients": { + "type": "array", + "items": { + "type": "string" + } + }, + "subject": { + "type": "string" + }, + "body": { + "type": "string" + }, + "replyTo": { + "type": "string" + }, + "cc": { + "type": "array", + "items": { + "type": "string" + } + }, + "bcc": { + "type": "array", + "items": { + "type": "string" + } + }, + "attachmentsVariableId": { + "type": "string" + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Webhook" + ], + "description": "Legacy name for HTTP Request block" + }, + "options": { + "type": "object", + "properties": { + "variablesForTest": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "variableId": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "responseVariableMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "variableId": { + "type": "string" + }, + "bodyPath": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "isAdvancedConfig": { + "type": "boolean" + }, + "isCustomBody": { + "type": "boolean" + }, + "isExecutedOnClient": { + "type": "boolean" + }, + "webhook": { + "type": "object", + "properties": { + "queryParams": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "headers": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "method": { + "type": "string", + "enum": [ + "POST", + "GET", + "PUT", + "DELETE", + "PATCH", + "HEAD", + "CONNECT", + "OPTIONS", + "TRACE" + ] + }, + "url": { + "type": "string" + }, + "body": { + "type": "string" + } + } + }, + "timeout": { + "type": "number", + "minimum": 1, + "maximum": 120 + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Zapier" + ] + }, + "options": { + "type": "object", + "properties": { + "variablesForTest": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "variableId": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "responseVariableMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "variableId": { + "type": "string" + }, + "bodyPath": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "isAdvancedConfig": { + "type": "boolean" + }, + "isCustomBody": { + "type": "boolean" + }, + "isExecutedOnClient": { + "type": "boolean" + }, + "webhook": { + "type": "object", + "properties": { + "queryParams": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "headers": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "method": { + "type": "string", + "enum": [ + "POST", + "GET", + "PUT", + "DELETE", + "PATCH", + "HEAD", + "CONNECT", + "OPTIONS", + "TRACE" + ] + }, + "url": { + "type": "string" + }, + "body": { + "type": "string" + } + } + }, + "timeout": { + "type": "number", + "minimum": 1, + "maximum": 120 + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Pixel" + ] + }, + "options": { + "oneOf": [ + { + "type": "object", + "properties": { + "pixelId": { + "type": "string" + }, + "isInitSkip": { + "type": "boolean" + }, + "params": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "key": { + "type": "string" + }, + "value": {} + }, + "required": [ + "id" + ] + } + } + } + }, + { + "type": "object", + "properties": { + "pixelId": { + "type": "string" + }, + "isInitSkip": { + "type": "boolean" + }, + "params": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "key": { + "type": "string" + }, + "value": {} + }, + "required": [ + "id" + ] + } + }, + "eventType": { + "type": "string", + "enum": [ + "Lead", + "Contact", + "CompleteRegistration", + "Schedule", + "SubmitApplication", + "ViewContent", + "AddPaymentInfo", + "AddToCart", + "AddToWishlist", + "CustomizeProduct", + "Donate", + "FindLocation", + "InitiateCheckout", + "Purchase", + "Search", + "StartTrial", + "Subscribe" + ] + } + }, + "required": [ + "eventType" + ] + }, + { + "type": "object", + "properties": { + "pixelId": { + "type": "string" + }, + "isInitSkip": { + "type": "boolean" + }, + "params": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "key": { + "type": "string" + }, + "value": {} + }, + "required": [ + "id" + ] + } + }, + "eventType": { + "type": "string", + "enum": [ + "Custom" + ] + }, + "name": { + "type": "string" + } + }, + "required": [ + "eventType" + ] + } + ] + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Zemantic AI" + ] + }, + "blockId": { + "type": "string" + }, + "options": { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "projectId": { + "type": "string" + }, + "systemPrompt": { + "type": "string" + }, + "prompt": { + "type": "string" + }, + "query": { + "type": "string" + }, + "maxResults": { + "type": "integer" + }, + "responseMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "valueToExtract": { + "type": "string", + "enum": [ + "Summary", + "Results" + ] + }, + "variableId": { + "type": "string" + } + }, + "required": [ + "id", + "valueToExtract" + ] + } + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "openai" + ] + }, + "options": { + "oneOf": [ + { + "type": "object", + "properties": { + "baseUrl": { + "type": "string" + }, + "apiVersion": { + "type": "string" + }, + "credentialsId": { + "type": "string" + } + }, + "description": "Deprecated, use other dedicated OpenAI compatible blocks instead" + }, + { + "type": "object", + "properties": { + "baseUrl": { + "type": "string" + }, + "apiVersion": { + "type": "string" + }, + "credentialsId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Create chat completion" + ] + }, + "model": { + "type": "string" + }, + "messages": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": {} + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "system" + ] + }, + "content": { + "type": "string" + } + }, + "required": [ + "role" + ] + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "user" + ] + }, + "content": { + "type": "string" + } + }, + "required": [ + "role" + ] + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "assistant" + ] + }, + "content": { + "type": "string" + } + }, + "required": [ + "role" + ] + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "Dialogue" + ] + }, + "dialogueVariableId": { + "type": "string" + }, + "startsBy": { + "type": "string", + "enum": [ + "user", + "assistant" + ] + } + }, + "required": [ + "role" + ] + } + ] + } + }, + "tools": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": {} + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "function" + ] + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "parameters": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": {} + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "string" + ] + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "boolean" + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "number" + ] + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "boolean" + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "boolean" + ] + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "boolean" + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "enum" + ] + }, + "values": { + "type": "array", + "items": { + "type": "string" + } + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "boolean" + } + }, + "required": [ + "type" + ] + } + ] + } + }, + "code": { + "type": "string" + } + }, + "required": [ + "type" + ] + } + ] + } + }, + "temperature": { + "anyOf": [ + { + "type": "number" + }, + {} + ] + }, + "responseMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "item": { + "type": "string", + "enum": [ + "Message content", + "Total tokens" + ] + }, + "variableId": { + "type": "string" + } + } + } + } + }, + "required": [ + "action" + ] + }, + { + "type": "object", + "properties": { + "baseUrl": { + "type": "string" + }, + "apiVersion": { + "type": "string" + }, + "credentialsId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Ask Assistant" + ] + }, + "assistantId": { + "type": "string" + }, + "threadId": { + "type": "string" + }, + "message": { + "type": "string" + }, + "functions": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "code": { + "type": "string" + } + } + } + }, + "responseMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "item": { + "type": "string", + "enum": [ + "Message", + "Thread ID" + ] + }, + "variableId": { + "type": "string" + } + } + } + } + }, + "required": [ + "action" + ] + }, + { + "type": "object", + "properties": { + "baseUrl": { + "type": "string" + }, + "apiVersion": { + "type": "string" + }, + "credentialsId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Create speech" + ] + }, + "model": { + "type": "string" + }, + "input": { + "type": "string" + }, + "voice": { + "type": "string", + "enum": [ + "alloy", + "echo", + "fable", + "onyx", + "nova", + "shimmer" + ] + }, + "saveUrlInVariableId": { + "type": "string" + } + }, + "required": [ + "action" + ] + } + ] + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "zemantic-ai" + ] + }, + "options": { + "oneOf": [ + { + "type": "object", + "properties": { + "projectId": { + "type": "string" + }, + "credentialsId": { + "type": "string" + } + } + }, + { + "type": "object", + "properties": { + "projectId": { + "type": "string" + }, + "credentialsId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Search documents" + ] + }, + "query": { + "type": "string" + }, + "maxResults": { + "anyOf": [ + { + "type": "number" + }, + {} + ] + }, + "systemPrompt": { + "type": "string" + }, + "prompt": { + "type": "string" + }, + "responseMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "item": { + "type": "string", + "enum": [ + "Summary", + "Document IDs", + "Texts", + "Scores" + ] + }, + "variableId": { + "type": "string" + } + } + } + } + }, + "required": [ + "action" + ] + } + ] + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "cal-com" + ] + }, + "options": { + "oneOf": [ + { + "type": "object", + "properties": { + "baseUrl": { + "type": "string" + }, + "credentialsId": { + "type": "string" + } + } + }, + { + "type": "object", + "properties": { + "baseUrl": { + "type": "string" + }, + "credentialsId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Book event" + ] + }, + "link": { + "type": "string" + }, + "layout": { + "type": "string", + "enum": [ + "Month", + "Weekly", + "Columns" + ] + }, + "name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "additionalNotes": { + "type": "string" + }, + "phone": { + "type": "string" + }, + "saveBookedDateInVariableId": { + "type": "string" + } + }, + "required": [ + "action" + ] + } + ] + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "chat-node" + ] + }, + "options": { + "oneOf": [ + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + } + } + }, + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Send Message" + ] + }, + "botId": { + "type": "string" + }, + "threadId": { + "type": "string" + }, + "message": { + "type": "string" + }, + "responseMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "item": { + "type": "string", + "enum": [ + "Message", + "Thread ID" + ] + }, + "variableId": { + "type": "string" + } + } + } + } + }, + "required": [ + "action" + ] + } + ] + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "qr-code" + ] + }, + "options": { + "oneOf": [ + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + } + } + }, + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Generate a QR Code" + ] + }, + "data": { + "type": "string" + }, + "saveUrlInVariableId": { + "type": "string" + } + }, + "required": [ + "action" + ] + } + ] + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "dify-ai" + ] + }, + "options": { + "oneOf": [ + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + } + } + }, + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Create Chat Message" + ] + }, + "query": { + "type": "string" + }, + "conversation_id": { + "type": "string" + }, + "user": { + "type": "string" + }, + "inputs": { + "type": "array", + "items": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + }, + "responseMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "item": { + "type": "string", + "enum": [ + "Answer", + "Conversation ID", + "Total Tokens" + ] + }, + "variableId": { + "type": "string" + } + } + } + } + }, + "required": [ + "action" + ] + } + ] + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "mistral" + ] + }, + "options": { + "oneOf": [ + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + } + } + }, + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Create chat completion" + ] + }, + "model": { + "type": "string" + }, + "messages": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": {} + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "system" + ] + }, + "content": { + "type": "string" + } + }, + "required": [ + "role" + ] + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "user" + ] + }, + "content": { + "type": "string" + } + }, + "required": [ + "role" + ] + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "assistant" + ] + }, + "content": { + "type": "string" + } + }, + "required": [ + "role" + ] + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "Dialogue" + ] + }, + "dialogueVariableId": { + "type": "string" + }, + "startsBy": { + "type": "string", + "enum": [ + "user", + "assistant" + ] + } + }, + "required": [ + "role" + ] + } + ] + } + }, + "responseMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "item": { + "type": "string", + "enum": [ + "Message content" + ] + }, + "variableId": { + "type": "string" + } + } + } + } + }, + "required": [ + "action" + ] + } + ] + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "elevenlabs" + ] + }, + "options": { + "oneOf": [ + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + } + } + }, + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Convert text to speech" + ] + }, + "text": { + "type": "string" + }, + "voiceId": { + "type": "string" + }, + "modelId": { + "type": "string" + }, + "saveUrlInVariableId": { + "type": "string" + } + }, + "required": [ + "action" + ] + } + ] + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "anthropic" + ] + }, + "options": { + "oneOf": [ + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + } + } + }, + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Create Chat Message" + ] + }, + "model": { + "type": "string", + "enum": [ + "claude-3-opus-20240229", + "claude-2.1", + "claude-2.0", + "claude-instant-1.2" + ] + }, + "messages": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": {} + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "user" + ] + }, + "content": { + "type": "string" + } + }, + "required": [ + "role" + ] + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "assistant" + ] + }, + "content": { + "type": "string" + } + }, + "required": [ + "role" + ] + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "Dialogue" + ] + }, + "dialogueVariableId": { + "type": "string" + }, + "startsBy": { + "type": "string", + "enum": [ + "user", + "assistant" + ] + } + }, + "required": [ + "role" + ] + } + ] + } + }, + "systemMessage": { + "type": "string" + }, + "temperature": { + "anyOf": [ + { + "type": "number" + }, + {} + ] + }, + "maxTokens": { + "anyOf": [ + { + "type": "number" + }, + {} + ] + }, + "responseMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "item": { + "type": "string", + "enum": [ + "Message Content" + ] + }, + "variableId": { + "type": "string" + } + } + } + } + }, + "required": [ + "action" + ] + } + ] + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "together-ai" + ] + }, + "options": { + "oneOf": [ + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + } + } + }, + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Create chat completion" + ] + }, + "model": { + "type": "string" + }, + "messages": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": {} + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "system" + ] + }, + "content": { + "type": "string" + } + }, + "required": [ + "role" + ] + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "user" + ] + }, + "content": { + "type": "string" + } + }, + "required": [ + "role" + ] + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "assistant" + ] + }, + "content": { + "type": "string" + } + }, + "required": [ + "role" + ] + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "Dialogue" + ] + }, + "dialogueVariableId": { + "type": "string" + }, + "startsBy": { + "type": "string", + "enum": [ + "user", + "assistant" + ] + } + }, + "required": [ + "role" + ] + } + ] + } + }, + "tools": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": {} + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "function" + ] + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "parameters": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": {} + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "string" + ] + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "boolean" + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "number" + ] + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "boolean" + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "boolean" + ] + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "boolean" + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "enum" + ] + }, + "values": { + "type": "array", + "items": { + "type": "string" + } + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "boolean" + } + }, + "required": [ + "type" + ] + } + ] + } + }, + "code": { + "type": "string" + } + }, + "required": [ + "type" + ] + } + ] + } + }, + "temperature": { + "anyOf": [ + { + "type": "number" + }, + {} + ] + }, + "responseMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "item": { + "type": "string", + "enum": [ + "Message content", + "Total tokens" + ] + }, + "variableId": { + "type": "string" + } + } + } + } + }, + "required": [ + "action" + ] + } + ] + } + }, + "required": [ + "id", + "type" ] }, { @@ -18831,20 +20345,296 @@ "type": { "type": "string", "enum": [ - "openai", - "zemantic-ai", - "cal-com", - "chat-node", - "qr-code", - "dify-ai", - "mistral", - "elevenlabs", - "anthropic", - "together-ai", "open-router" ] }, - "options": {} + "options": { + "oneOf": [ + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + } + } + }, + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Create chat completion" + ] + }, + "model": { + "type": "string" + }, + "messages": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": {} + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "system" + ] + }, + "content": { + "type": "string" + } + }, + "required": [ + "role" + ] + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "user" + ] + }, + "content": { + "type": "string" + } + }, + "required": [ + "role" + ] + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "assistant" + ] + }, + "content": { + "type": "string" + } + }, + "required": [ + "role" + ] + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "Dialogue" + ] + }, + "dialogueVariableId": { + "type": "string" + }, + "startsBy": { + "type": "string", + "enum": [ + "user", + "assistant" + ] + } + }, + "required": [ + "role" + ] + } + ] + } + }, + "tools": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": {} + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "function" + ] + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "parameters": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": {} + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "string" + ] + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "boolean" + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "number" + ] + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "boolean" + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "boolean" + ] + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "boolean" + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "enum" + ] + }, + "values": { + "type": "array", + "items": { + "type": "string" + } + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "boolean" + } + }, + "required": [ + "type" + ] + } + ] + } + }, + "code": { + "type": "string" + } + }, + "required": [ + "type" + ] + } + ] + } + }, + "temperature": { + "anyOf": [ + { + "type": "number" + }, + {} + ] + }, + "responseMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "item": { + "type": "string", + "enum": [ + "Message content", + "Total tokens" + ] + }, + "variableId": { + "type": "string" + } + } + } + } + }, + "required": [ + "action" + ] + } + ] + } }, "required": [ "id", diff --git a/apps/docs/openapi/viewer.json b/apps/docs/openapi/viewer.json index f7867b46a..72d082c59 100644 --- a/apps/docs/openapi/viewer.json +++ b/apps/docs/openapi/viewer.json @@ -7085,2311 +7085,3825 @@ "title": "Group V6" }, "block": { - "anyOf": [ + "oneOf": [ { - "oneOf": [ - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "text" - ] - }, - "content": { - "type": "object", - "properties": { - "html": { - "type": "string" - }, - "richText": { - "type": "array", - "items": {} - }, - "plainText": { - "type": "string" - } - } - } - }, - "required": [ - "id", - "type" + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "text" ] }, - { + "content": { "type": "object", "properties": { - "id": { + "html": { "type": "string" }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "image" - ] - }, - "content": { - "type": "object", - "properties": { - "url": { - "type": "string" - }, - "clickLink": { - "type": "object", - "properties": { - "url": { - "type": "string" - }, - "alt": { - "type": "string" - } - } - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "video" - ] - }, - "content": { - "type": "object", - "properties": { - "url": { - "type": "string" - }, - "id": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "url", - "youtube", - "vimeo", - "tiktok", - "gumlet" - ] - }, - "height": { - "anyOf": [ - { - "type": "number" - }, - {} - ] - }, - "aspectRatio": { - "type": "string" - }, - "maxWidth": { - "type": "string" - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "embed" - ] - }, - "content": { - "type": "object", - "properties": { - "url": { - "type": "string" - }, - "height": { - "anyOf": [ - { - "type": "number" - }, - {} - ] - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "audio" - ] - }, - "content": { - "type": "object", - "properties": { - "url": { - "type": "string" - }, - "isAutoplayEnabled": { - "type": "boolean" - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "$ref": "#/components/schemas/textInput" - }, - { - "$ref": "#/components/schemas/buttonsInput" - }, - { - "$ref": "#/components/schemas/email" - }, - { - "$ref": "#/components/schemas/numberInput" - }, - { - "$ref": "#/components/schemas/url" - }, - { - "$ref": "#/components/schemas/phoneNumberInput" - }, - { - "$ref": "#/components/schemas/dateInput" - }, - { - "$ref": "#/components/schemas/paymentInput" - }, - { - "$ref": "#/components/schemas/rating" - }, - { - "$ref": "#/components/schemas/fileInput" - }, - { - "$ref": "#/components/schemas/pictureChoice" - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Code" - ] - }, - "options": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "content": { - "type": "string" - }, - "isExecutedOnClient": { - "type": "boolean" - }, - "shouldExecuteInParentContext": { - "type": "boolean" - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Condition" - ] - }, - "items": { + "richText": { "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "content": { - "type": "object", - "properties": { - "logicalOperator": { - "type": "string", - "enum": [ - "OR", - "AND" - ] - }, - "comparisons": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "variableId": { - "type": "string" - }, - "comparisonOperator": { - "type": "string", - "enum": [ - "Equal to", - "Not equal", - "Contains", - "Does not contain", - "Greater than", - "Less than", - "Is set", - "Is empty", - "Starts with", - "Ends with", - "Matches regex", - "Does not match regex" - ] - }, - "value": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - } - } - } - }, - "required": [ - "id" - ] - } + "items": {} + }, + "plainText": { + "type": "string" } - }, - "required": [ - "id", - "type", - "items" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Redirect" - ] - }, - "options": { - "type": "object", - "properties": { - "url": { - "type": "string" - }, - "isNewTab": { - "type": "boolean" - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Set variable" - ] - }, - "options": { - "oneOf": [ - { - "type": "object", - "properties": { - "variableId": { - "type": "string" - }, - "isExecutedOnClient": { - "type": "boolean" - }, - "expressionToEvaluate": { - "type": "string" - }, - "isCode": { - "type": "boolean" - } - } - }, - { - "type": "object", - "properties": { - "variableId": { - "type": "string" - }, - "isExecutedOnClient": { - "type": "boolean" - }, - "type": { - "type": "string", - "enum": [ - "Now", - "Yesterday", - "Tomorrow" - ] - }, - "timeZone": { - "type": "string" - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "variableId": { - "type": "string" - }, - "isExecutedOnClient": { - "type": "boolean" - }, - "type": { - "type": "string", - "enum": [ - "Today", - "Moment of the day", - "Empty", - "Environment name", - "User ID", - "Result ID", - "Random ID", - "Phone number", - "Contact name" - ] - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "variableId": { - "type": "string" - }, - "isExecutedOnClient": { - "type": "boolean" - }, - "type": { - "type": "string", - "enum": [ - "Custom" - ] - }, - "expressionToEvaluate": { - "type": "string" - }, - "isCode": { - "type": "boolean" - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "variableId": { - "type": "string" - }, - "isExecutedOnClient": { - "type": "boolean" - }, - "type": { - "type": "string", - "enum": [ - "Map item with same index" - ] - }, - "mapListItemParams": { - "type": "object", - "properties": { - "baseItemVariableId": { - "type": "string" - }, - "baseListVariableId": { - "type": "string" - }, - "targetListVariableId": { - "type": "string" - } - } - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "variableId": { - "type": "string" - }, - "isExecutedOnClient": { - "type": "boolean" - }, - "type": { - "type": "string", - "enum": [ - "Append value(s)" - ] - }, - "item": { - "type": "string" - } - }, - "required": [ - "type" - ] - } - ] - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Typebot link" - ] - }, - "options": { - "type": "object", - "properties": { - "typebotId": { - "type": "string" - }, - "groupId": { - "type": "string" - }, - "mergeResults": { - "type": "boolean" - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Wait" - ] - }, - "options": { - "type": "object", - "properties": { - "secondsToWaitFor": { - "type": "string" - }, - "shouldPause": { - "type": "boolean" - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Jump" - ] - }, - "options": { - "type": "object", - "properties": { - "groupId": { - "type": "string" - }, - "blockId": { - "type": "string" - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "AB test" - ] - }, - "items": { - "type": "array", - "maxItems": 2, - "minItems": 2, - "items": { - "oneOf": [ - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "path": { - "type": "string", - "enum": [ - "a" - ] - } - }, - "required": [ - "id", - "path" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "path": { - "type": "string", - "enum": [ - "b" - ] - } - }, - "required": [ - "id", - "path" - ] - } - ] - } - }, - "options": { - "type": "object", - "properties": { - "aPercent": { - "type": "number", - "minimum": 0, - "maximum": 100 - } - } - } - }, - "required": [ - "id", - "type", - "items" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Chatwoot" - ] - }, - "options": { - "type": "object", - "properties": { - "task": { - "type": "string", - "enum": [ - "Show widget", - "Close widget" - ] - }, - "baseUrl": { - "type": "string" - }, - "websiteToken": { - "type": "string" - }, - "user": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "email": { - "type": "string" - }, - "name": { - "type": "string" - }, - "avatarUrl": { - "type": "string" - }, - "phoneNumber": { - "type": "string" - } - } - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Google Analytics" - ] - }, - "options": { - "type": "object", - "properties": { - "trackingId": { - "type": "string" - }, - "category": { - "type": "string" - }, - "action": { - "type": "string" - }, - "label": { - "type": "string" - }, - "value": { - "anyOf": [ - { - "type": "number" - }, - {} - ] - }, - "sendTo": { - "type": "string" - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Google Sheets" - ] - }, - "options": { - "oneOf": [ - { - "type": "object", - "properties": { - "credentialsId": { - "type": "string" - }, - "sheetId": { - "type": "string" - }, - "spreadsheetId": { - "type": "string" - }, - "action": { - "type": "string", - "enum": [ - "Get data from sheet" - ] - }, - "filter": { - "type": "object", - "properties": { - "comparisons": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "column": { - "type": "string" - }, - "comparisonOperator": { - "type": "string", - "enum": [ - "Equal to", - "Not equal", - "Contains", - "Does not contain", - "Greater than", - "Less than", - "Is set", - "Is empty", - "Starts with", - "Ends with", - "Matches regex", - "Does not match regex" - ] - }, - "value": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "logicalOperator": { - "type": "string", - "enum": [ - "OR", - "AND" - ] - } - } - }, - "cellsToExtract": { - "type": "array", - "items": { - "type": "object", - "properties": { - "column": { - "type": "string" - }, - "id": { - "type": "string" - }, - "variableId": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "totalRowsToExtract": { - "type": "string", - "enum": [ - "All", - "First", - "Last", - "Random" - ] - } - }, - "required": [ - "action" - ] - }, - { - "type": "object", - "properties": { - "credentialsId": { - "type": "string" - }, - "sheetId": { - "type": "string" - }, - "spreadsheetId": { - "type": "string" - }, - "action": { - "type": "string", - "enum": [ - "Insert a row" - ] - }, - "cellsToInsert": { - "type": "array", - "items": { - "type": "object", - "properties": { - "column": { - "type": "string" - }, - "value": { - "type": "string" - }, - "id": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - } - }, - "required": [ - "action" - ] - }, - { - "type": "object", - "properties": { - "credentialsId": { - "type": "string" - }, - "sheetId": { - "type": "string" - }, - "spreadsheetId": { - "type": "string" - }, - "action": { - "type": "string", - "enum": [ - "Update a row" - ] - }, - "cellsToUpsert": { - "type": "array", - "items": { - "type": "object", - "properties": { - "column": { - "type": "string" - }, - "value": { - "type": "string" - }, - "id": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "filter": { - "type": "object", - "properties": { - "comparisons": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "column": { - "type": "string" - }, - "comparisonOperator": { - "type": "string", - "enum": [ - "Equal to", - "Not equal", - "Contains", - "Does not contain", - "Greater than", - "Less than", - "Is set", - "Is empty", - "Starts with", - "Ends with", - "Matches regex", - "Does not match regex" - ] - }, - "value": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "logicalOperator": { - "type": "string", - "enum": [ - "OR", - "AND" - ] - } - } - } - }, - "required": [ - "action" - ] - }, - { - "type": "object", - "properties": { - "credentialsId": { - "type": "string" - }, - "sheetId": { - "type": "string" - }, - "spreadsheetId": { - "type": "string" - } - } - } - ] - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Make.com" - ] - }, - "options": { - "type": "object", - "properties": { - "variablesForTest": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "variableId": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "responseVariableMapping": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "variableId": { - "type": "string" - }, - "bodyPath": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "isAdvancedConfig": { - "type": "boolean" - }, - "isCustomBody": { - "type": "boolean" - }, - "isExecutedOnClient": { - "type": "boolean" - }, - "webhook": { - "type": "object", - "properties": { - "queryParams": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "headers": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "method": { - "type": "string", - "enum": [ - "POST", - "GET", - "PUT", - "DELETE", - "PATCH", - "HEAD", - "CONNECT", - "OPTIONS", - "TRACE" - ] - }, - "url": { - "type": "string" - }, - "body": { - "type": "string" - } - } - }, - "timeout": { - "type": "number", - "minimum": 1, - "maximum": 120 - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "OpenAI" - ] - }, - "options": { - "oneOf": [ - { - "type": "object", - "properties": { - "credentialsId": { - "type": "string" - }, - "baseUrl": { - "type": "string" - }, - "apiVersion": { - "type": "string" - } - } - }, - { - "type": "object", - "properties": { - "task": { - "type": "string", - "enum": [ - "Create chat completion" - ] - }, - "model": { - "type": "string" - }, - "messages": { - "type": "array", - "items": { - "anyOf": [ - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "role": { - "type": "string", - "enum": [ - "system", - "user", - "assistant" - ] - }, - "content": { - "type": "string" - }, - "name": { - "type": "string" - } - }, - "required": [ - "id" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "role": { - "type": "string", - "enum": [ - "Messages sequence ✨" - ] - }, - "content": { - "type": "object", - "properties": { - "assistantMessagesVariableId": { - "type": "string" - }, - "userMessagesVariableId": { - "type": "string" - } - } - } - }, - "required": [ - "id", - "role" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "role": { - "type": "string", - "enum": [ - "Dialogue" - ] - }, - "dialogueVariableId": { - "type": "string" - }, - "startsBy": { - "type": "string", - "enum": [ - "user", - "assistant" - ] - } - }, - "required": [ - "id", - "role" - ] - } - ] - } - }, - "advancedSettings": { - "type": "object", - "properties": { - "temperature": { - "anyOf": [ - { - "type": "number" - }, - {} - ] - } - } - }, - "responseMapping": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "valueToExtract": { - "type": "string", - "enum": [ - "Message content", - "Total tokens" - ] - }, - "variableId": { - "type": "string" - } - }, - "required": [ - "id", - "valueToExtract" - ] - } - }, - "credentialsId": { - "type": "string" - }, - "baseUrl": { - "type": "string" - }, - "apiVersion": { - "type": "string" - } - }, - "required": [ - "task" - ] - }, - { - "type": "object", - "properties": { - "task": { - "type": "string", - "enum": [ - "Create image" - ] - }, - "prompt": { - "type": "string" - }, - "advancedOptions": { - "type": "object", - "properties": { - "size": { - "type": "string", - "enum": [ - "256x256", - "512x512", - "1024x1024" - ] - } - } - }, - "responseMapping": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "valueToExtract": { - "type": "string", - "enum": [ - "Image URL" - ] - }, - "variableId": { - "type": "string" - } - }, - "required": [ - "id", - "valueToExtract" - ] - } - }, - "credentialsId": { - "type": "string" - }, - "baseUrl": { - "type": "string" - }, - "apiVersion": { - "type": "string" - } - }, - "required": [ - "task", - "advancedOptions", - "responseMapping" - ] - }, - { - "type": "object", - "properties": { - "credentialsId": { - "type": "string" - }, - "baseUrl": { - "type": "string" - }, - "apiVersion": { - "type": "string" - }, - "task": { - "type": "string", - "enum": [ - "Create speech" - ] - }, - "model": { - "type": "string" - }, - "input": { - "type": "string" - }, - "voice": { - "type": "string", - "enum": [ - "alloy", - "echo", - "fable", - "onyx", - "nova", - "shimmer" - ] - }, - "saveUrlInVariableId": { - "type": "string" - } - }, - "required": [ - "task" - ] - } - ] - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Pabbly" - ] - }, - "options": { - "type": "object", - "properties": { - "variablesForTest": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "variableId": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "responseVariableMapping": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "variableId": { - "type": "string" - }, - "bodyPath": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "isAdvancedConfig": { - "type": "boolean" - }, - "isCustomBody": { - "type": "boolean" - }, - "isExecutedOnClient": { - "type": "boolean" - }, - "webhook": { - "type": "object", - "properties": { - "queryParams": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "headers": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "method": { - "type": "string", - "enum": [ - "POST", - "GET", - "PUT", - "DELETE", - "PATCH", - "HEAD", - "CONNECT", - "OPTIONS", - "TRACE" - ] - }, - "url": { - "type": "string" - }, - "body": { - "type": "string" - } - } - }, - "timeout": { - "type": "number", - "minimum": 1, - "maximum": 120 - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Email" - ] - }, - "options": { - "type": "object", - "properties": { - "credentialsId": { - "type": "string" - }, - "isCustomBody": { - "type": "boolean" - }, - "isBodyCode": { - "type": "boolean" - }, - "recipients": { - "type": "array", - "items": { - "type": "string" - } - }, - "subject": { - "type": "string" - }, - "body": { - "type": "string" - }, - "replyTo": { - "type": "string" - }, - "cc": { - "type": "array", - "items": { - "type": "string" - } - }, - "bcc": { - "type": "array", - "items": { - "type": "string" - } - }, - "attachmentsVariableId": { - "type": "string" - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Webhook" - ], - "description": "Legacy name for HTTP Request block" - }, - "options": { - "type": "object", - "properties": { - "variablesForTest": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "variableId": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "responseVariableMapping": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "variableId": { - "type": "string" - }, - "bodyPath": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "isAdvancedConfig": { - "type": "boolean" - }, - "isCustomBody": { - "type": "boolean" - }, - "isExecutedOnClient": { - "type": "boolean" - }, - "webhook": { - "type": "object", - "properties": { - "queryParams": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "headers": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "method": { - "type": "string", - "enum": [ - "POST", - "GET", - "PUT", - "DELETE", - "PATCH", - "HEAD", - "CONNECT", - "OPTIONS", - "TRACE" - ] - }, - "url": { - "type": "string" - }, - "body": { - "type": "string" - } - } - }, - "timeout": { - "type": "number", - "minimum": 1, - "maximum": 120 - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Zapier" - ] - }, - "options": { - "type": "object", - "properties": { - "variablesForTest": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "variableId": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "responseVariableMapping": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "variableId": { - "type": "string" - }, - "bodyPath": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "isAdvancedConfig": { - "type": "boolean" - }, - "isCustomBody": { - "type": "boolean" - }, - "isExecutedOnClient": { - "type": "boolean" - }, - "webhook": { - "type": "object", - "properties": { - "queryParams": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "headers": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "required": [ - "id" - ] - } - }, - "method": { - "type": "string", - "enum": [ - "POST", - "GET", - "PUT", - "DELETE", - "PATCH", - "HEAD", - "CONNECT", - "OPTIONS", - "TRACE" - ] - }, - "url": { - "type": "string" - }, - "body": { - "type": "string" - } - } - }, - "timeout": { - "type": "number", - "minimum": 1, - "maximum": 120 - } - } - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Pixel" - ] - }, - "options": { - "oneOf": [ - { - "type": "object", - "properties": { - "pixelId": { - "type": "string" - }, - "isInitSkip": { - "type": "boolean" - }, - "params": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "key": { - "type": "string" - }, - "value": {} - }, - "required": [ - "id" - ] - } - } - } - }, - { - "type": "object", - "properties": { - "pixelId": { - "type": "string" - }, - "isInitSkip": { - "type": "boolean" - }, - "params": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "key": { - "type": "string" - }, - "value": {} - }, - "required": [ - "id" - ] - } - }, - "eventType": { - "type": "string", - "enum": [ - "Lead", - "Contact", - "CompleteRegistration", - "Schedule", - "SubmitApplication", - "ViewContent", - "AddPaymentInfo", - "AddToCart", - "AddToWishlist", - "CustomizeProduct", - "Donate", - "FindLocation", - "InitiateCheckout", - "Purchase", - "Search", - "StartTrial", - "Subscribe" - ] - } - }, - "required": [ - "eventType" - ] - }, - { - "type": "object", - "properties": { - "pixelId": { - "type": "string" - }, - "isInitSkip": { - "type": "boolean" - }, - "params": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "key": { - "type": "string" - }, - "value": {} - }, - "required": [ - "id" - ] - } - }, - "eventType": { - "type": "string", - "enum": [ - "Custom" - ] - }, - "name": { - "type": "string" - } - }, - "required": [ - "eventType" - ] - } - ] - } - }, - "required": [ - "id", - "type" - ] - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "outgoingEdgeId": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "Zemantic AI" - ] - }, - "blockId": { - "type": "string" - }, - "options": { - "type": "object", - "properties": { - "credentialsId": { - "type": "string" - }, - "projectId": { - "type": "string" - }, - "systemPrompt": { - "type": "string" - }, - "prompt": { - "type": "string" - }, - "query": { - "type": "string" - }, - "maxResults": { - "type": "integer" - }, - "responseMapping": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "valueToExtract": { - "type": "string", - "enum": [ - "Summary", - "Results" - ] - }, - "variableId": { - "type": "string" - } - }, - "required": [ - "id", - "valueToExtract" - ] - } - } - } - } - }, - "required": [ - "id", - "type" - ] + } } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "image" + ] + }, + "content": { + "type": "object", + "properties": { + "url": { + "type": "string" + }, + "clickLink": { + "type": "object", + "properties": { + "url": { + "type": "string" + }, + "alt": { + "type": "string" + } + } + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "video" + ] + }, + "content": { + "type": "object", + "properties": { + "url": { + "type": "string" + }, + "id": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "url", + "youtube", + "vimeo", + "tiktok", + "gumlet" + ] + }, + "height": { + "anyOf": [ + { + "type": "number" + }, + {} + ] + }, + "aspectRatio": { + "type": "string" + }, + "maxWidth": { + "type": "string" + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "embed" + ] + }, + "content": { + "type": "object", + "properties": { + "url": { + "type": "string" + }, + "height": { + "anyOf": [ + { + "type": "number" + }, + {} + ] + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "audio" + ] + }, + "content": { + "type": "object", + "properties": { + "url": { + "type": "string" + }, + "isAutoplayEnabled": { + "type": "boolean" + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "$ref": "#/components/schemas/textInput" + }, + { + "$ref": "#/components/schemas/buttonsInput" + }, + { + "$ref": "#/components/schemas/email" + }, + { + "$ref": "#/components/schemas/numberInput" + }, + { + "$ref": "#/components/schemas/url" + }, + { + "$ref": "#/components/schemas/phoneNumberInput" + }, + { + "$ref": "#/components/schemas/dateInput" + }, + { + "$ref": "#/components/schemas/paymentInput" + }, + { + "$ref": "#/components/schemas/rating" + }, + { + "$ref": "#/components/schemas/fileInput" + }, + { + "$ref": "#/components/schemas/pictureChoice" + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Code" + ] + }, + "options": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "content": { + "type": "string" + }, + "isExecutedOnClient": { + "type": "boolean" + }, + "shouldExecuteInParentContext": { + "type": "boolean" + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Condition" + ] + }, + "items": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "content": { + "type": "object", + "properties": { + "logicalOperator": { + "type": "string", + "enum": [ + "OR", + "AND" + ] + }, + "comparisons": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "variableId": { + "type": "string" + }, + "comparisonOperator": { + "type": "string", + "enum": [ + "Equal to", + "Not equal", + "Contains", + "Does not contain", + "Greater than", + "Less than", + "Is set", + "Is empty", + "Starts with", + "Ends with", + "Matches regex", + "Does not match regex" + ] + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + } + } + } + }, + "required": [ + "id" + ] + } + } + }, + "required": [ + "id", + "type", + "items" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Redirect" + ] + }, + "options": { + "type": "object", + "properties": { + "url": { + "type": "string" + }, + "isNewTab": { + "type": "boolean" + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Set variable" + ] + }, + "options": { + "oneOf": [ + { + "type": "object", + "properties": { + "variableId": { + "type": "string" + }, + "isExecutedOnClient": { + "type": "boolean" + }, + "expressionToEvaluate": { + "type": "string" + }, + "isCode": { + "type": "boolean" + } + } + }, + { + "type": "object", + "properties": { + "variableId": { + "type": "string" + }, + "isExecutedOnClient": { + "type": "boolean" + }, + "type": { + "type": "string", + "enum": [ + "Now", + "Yesterday", + "Tomorrow" + ] + }, + "timeZone": { + "type": "string" + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "variableId": { + "type": "string" + }, + "isExecutedOnClient": { + "type": "boolean" + }, + "type": { + "type": "string", + "enum": [ + "Today", + "Moment of the day", + "Empty", + "Environment name", + "User ID", + "Result ID", + "Random ID", + "Phone number", + "Contact name" + ] + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "variableId": { + "type": "string" + }, + "isExecutedOnClient": { + "type": "boolean" + }, + "type": { + "type": "string", + "enum": [ + "Custom" + ] + }, + "expressionToEvaluate": { + "type": "string" + }, + "isCode": { + "type": "boolean" + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "variableId": { + "type": "string" + }, + "isExecutedOnClient": { + "type": "boolean" + }, + "type": { + "type": "string", + "enum": [ + "Map item with same index" + ] + }, + "mapListItemParams": { + "type": "object", + "properties": { + "baseItemVariableId": { + "type": "string" + }, + "baseListVariableId": { + "type": "string" + }, + "targetListVariableId": { + "type": "string" + } + } + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "variableId": { + "type": "string" + }, + "isExecutedOnClient": { + "type": "boolean" + }, + "type": { + "type": "string", + "enum": [ + "Append value(s)" + ] + }, + "item": { + "type": "string" + } + }, + "required": [ + "type" + ] + } + ] + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Typebot link" + ] + }, + "options": { + "type": "object", + "properties": { + "typebotId": { + "type": "string" + }, + "groupId": { + "type": "string" + }, + "mergeResults": { + "type": "boolean" + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Wait" + ] + }, + "options": { + "type": "object", + "properties": { + "secondsToWaitFor": { + "type": "string" + }, + "shouldPause": { + "type": "boolean" + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Jump" + ] + }, + "options": { + "type": "object", + "properties": { + "groupId": { + "type": "string" + }, + "blockId": { + "type": "string" + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "AB test" + ] + }, + "items": { + "type": "array", + "maxItems": 2, + "minItems": 2, + "items": { + "oneOf": [ + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "path": { + "type": "string", + "enum": [ + "a" + ] + } + }, + "required": [ + "id", + "path" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "path": { + "type": "string", + "enum": [ + "b" + ] + } + }, + "required": [ + "id", + "path" + ] + } + ] + } + }, + "options": { + "type": "object", + "properties": { + "aPercent": { + "type": "number", + "minimum": 0, + "maximum": 100 + } + } + } + }, + "required": [ + "id", + "type", + "items" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Chatwoot" + ] + }, + "options": { + "type": "object", + "properties": { + "task": { + "type": "string", + "enum": [ + "Show widget", + "Close widget" + ] + }, + "baseUrl": { + "type": "string" + }, + "websiteToken": { + "type": "string" + }, + "user": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "email": { + "type": "string" + }, + "name": { + "type": "string" + }, + "avatarUrl": { + "type": "string" + }, + "phoneNumber": { + "type": "string" + } + } + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Google Analytics" + ] + }, + "options": { + "type": "object", + "properties": { + "trackingId": { + "type": "string" + }, + "category": { + "type": "string" + }, + "action": { + "type": "string" + }, + "label": { + "type": "string" + }, + "value": { + "anyOf": [ + { + "type": "number" + }, + {} + ] + }, + "sendTo": { + "type": "string" + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Google Sheets" + ] + }, + "options": { + "oneOf": [ + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "sheetId": { + "type": "string" + }, + "spreadsheetId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Get data from sheet" + ] + }, + "filter": { + "type": "object", + "properties": { + "comparisons": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "column": { + "type": "string" + }, + "comparisonOperator": { + "type": "string", + "enum": [ + "Equal to", + "Not equal", + "Contains", + "Does not contain", + "Greater than", + "Less than", + "Is set", + "Is empty", + "Starts with", + "Ends with", + "Matches regex", + "Does not match regex" + ] + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "logicalOperator": { + "type": "string", + "enum": [ + "OR", + "AND" + ] + } + } + }, + "cellsToExtract": { + "type": "array", + "items": { + "type": "object", + "properties": { + "column": { + "type": "string" + }, + "id": { + "type": "string" + }, + "variableId": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "totalRowsToExtract": { + "type": "string", + "enum": [ + "All", + "First", + "Last", + "Random" + ] + } + }, + "required": [ + "action" + ] + }, + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "sheetId": { + "type": "string" + }, + "spreadsheetId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Insert a row" + ] + }, + "cellsToInsert": { + "type": "array", + "items": { + "type": "object", + "properties": { + "column": { + "type": "string" + }, + "value": { + "type": "string" + }, + "id": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + } + }, + "required": [ + "action" + ] + }, + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "sheetId": { + "type": "string" + }, + "spreadsheetId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Update a row" + ] + }, + "cellsToUpsert": { + "type": "array", + "items": { + "type": "object", + "properties": { + "column": { + "type": "string" + }, + "value": { + "type": "string" + }, + "id": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "filter": { + "type": "object", + "properties": { + "comparisons": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "column": { + "type": "string" + }, + "comparisonOperator": { + "type": "string", + "enum": [ + "Equal to", + "Not equal", + "Contains", + "Does not contain", + "Greater than", + "Less than", + "Is set", + "Is empty", + "Starts with", + "Ends with", + "Matches regex", + "Does not match regex" + ] + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "logicalOperator": { + "type": "string", + "enum": [ + "OR", + "AND" + ] + } + } + } + }, + "required": [ + "action" + ] + }, + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "sheetId": { + "type": "string" + }, + "spreadsheetId": { + "type": "string" + } + } + } + ] + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Make.com" + ] + }, + "options": { + "type": "object", + "properties": { + "variablesForTest": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "variableId": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "responseVariableMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "variableId": { + "type": "string" + }, + "bodyPath": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "isAdvancedConfig": { + "type": "boolean" + }, + "isCustomBody": { + "type": "boolean" + }, + "isExecutedOnClient": { + "type": "boolean" + }, + "webhook": { + "type": "object", + "properties": { + "queryParams": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "headers": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "method": { + "type": "string", + "enum": [ + "POST", + "GET", + "PUT", + "DELETE", + "PATCH", + "HEAD", + "CONNECT", + "OPTIONS", + "TRACE" + ] + }, + "url": { + "type": "string" + }, + "body": { + "type": "string" + } + } + }, + "timeout": { + "type": "number", + "minimum": 1, + "maximum": 120 + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "OpenAI" + ] + }, + "options": { + "oneOf": [ + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "baseUrl": { + "type": "string" + }, + "apiVersion": { + "type": "string" + } + } + }, + { + "type": "object", + "properties": { + "task": { + "type": "string", + "enum": [ + "Create chat completion" + ] + }, + "model": { + "type": "string" + }, + "messages": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "role": { + "type": "string", + "enum": [ + "system", + "user", + "assistant" + ] + }, + "content": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "required": [ + "id" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "role": { + "type": "string", + "enum": [ + "Messages sequence ✨" + ] + }, + "content": { + "type": "object", + "properties": { + "assistantMessagesVariableId": { + "type": "string" + }, + "userMessagesVariableId": { + "type": "string" + } + } + } + }, + "required": [ + "id", + "role" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "role": { + "type": "string", + "enum": [ + "Dialogue" + ] + }, + "dialogueVariableId": { + "type": "string" + }, + "startsBy": { + "type": "string", + "enum": [ + "user", + "assistant" + ] + } + }, + "required": [ + "id", + "role" + ] + } + ] + } + }, + "advancedSettings": { + "type": "object", + "properties": { + "temperature": { + "anyOf": [ + { + "type": "number" + }, + {} + ] + } + } + }, + "responseMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "valueToExtract": { + "type": "string", + "enum": [ + "Message content", + "Total tokens" + ] + }, + "variableId": { + "type": "string" + } + }, + "required": [ + "id", + "valueToExtract" + ] + } + }, + "credentialsId": { + "type": "string" + }, + "baseUrl": { + "type": "string" + }, + "apiVersion": { + "type": "string" + } + }, + "required": [ + "task" + ] + }, + { + "type": "object", + "properties": { + "task": { + "type": "string", + "enum": [ + "Create image" + ] + }, + "prompt": { + "type": "string" + }, + "advancedOptions": { + "type": "object", + "properties": { + "size": { + "type": "string", + "enum": [ + "256x256", + "512x512", + "1024x1024" + ] + } + } + }, + "responseMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "valueToExtract": { + "type": "string", + "enum": [ + "Image URL" + ] + }, + "variableId": { + "type": "string" + } + }, + "required": [ + "id", + "valueToExtract" + ] + } + }, + "credentialsId": { + "type": "string" + }, + "baseUrl": { + "type": "string" + }, + "apiVersion": { + "type": "string" + } + }, + "required": [ + "task", + "advancedOptions", + "responseMapping" + ] + }, + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "baseUrl": { + "type": "string" + }, + "apiVersion": { + "type": "string" + }, + "task": { + "type": "string", + "enum": [ + "Create speech" + ] + }, + "model": { + "type": "string" + }, + "input": { + "type": "string" + }, + "voice": { + "type": "string", + "enum": [ + "alloy", + "echo", + "fable", + "onyx", + "nova", + "shimmer" + ] + }, + "saveUrlInVariableId": { + "type": "string" + } + }, + "required": [ + "task" + ] + } + ] + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Pabbly" + ] + }, + "options": { + "type": "object", + "properties": { + "variablesForTest": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "variableId": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "responseVariableMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "variableId": { + "type": "string" + }, + "bodyPath": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "isAdvancedConfig": { + "type": "boolean" + }, + "isCustomBody": { + "type": "boolean" + }, + "isExecutedOnClient": { + "type": "boolean" + }, + "webhook": { + "type": "object", + "properties": { + "queryParams": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "headers": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "method": { + "type": "string", + "enum": [ + "POST", + "GET", + "PUT", + "DELETE", + "PATCH", + "HEAD", + "CONNECT", + "OPTIONS", + "TRACE" + ] + }, + "url": { + "type": "string" + }, + "body": { + "type": "string" + } + } + }, + "timeout": { + "type": "number", + "minimum": 1, + "maximum": 120 + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Email" + ] + }, + "options": { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "isCustomBody": { + "type": "boolean" + }, + "isBodyCode": { + "type": "boolean" + }, + "recipients": { + "type": "array", + "items": { + "type": "string" + } + }, + "subject": { + "type": "string" + }, + "body": { + "type": "string" + }, + "replyTo": { + "type": "string" + }, + "cc": { + "type": "array", + "items": { + "type": "string" + } + }, + "bcc": { + "type": "array", + "items": { + "type": "string" + } + }, + "attachmentsVariableId": { + "type": "string" + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Webhook" + ], + "description": "Legacy name for HTTP Request block" + }, + "options": { + "type": "object", + "properties": { + "variablesForTest": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "variableId": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "responseVariableMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "variableId": { + "type": "string" + }, + "bodyPath": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "isAdvancedConfig": { + "type": "boolean" + }, + "isCustomBody": { + "type": "boolean" + }, + "isExecutedOnClient": { + "type": "boolean" + }, + "webhook": { + "type": "object", + "properties": { + "queryParams": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "headers": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "method": { + "type": "string", + "enum": [ + "POST", + "GET", + "PUT", + "DELETE", + "PATCH", + "HEAD", + "CONNECT", + "OPTIONS", + "TRACE" + ] + }, + "url": { + "type": "string" + }, + "body": { + "type": "string" + } + } + }, + "timeout": { + "type": "number", + "minimum": 1, + "maximum": 120 + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Zapier" + ] + }, + "options": { + "type": "object", + "properties": { + "variablesForTest": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "variableId": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "responseVariableMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "variableId": { + "type": "string" + }, + "bodyPath": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "isAdvancedConfig": { + "type": "boolean" + }, + "isCustomBody": { + "type": "boolean" + }, + "isExecutedOnClient": { + "type": "boolean" + }, + "webhook": { + "type": "object", + "properties": { + "queryParams": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "headers": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + }, + "method": { + "type": "string", + "enum": [ + "POST", + "GET", + "PUT", + "DELETE", + "PATCH", + "HEAD", + "CONNECT", + "OPTIONS", + "TRACE" + ] + }, + "url": { + "type": "string" + }, + "body": { + "type": "string" + } + } + }, + "timeout": { + "type": "number", + "minimum": 1, + "maximum": 120 + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Pixel" + ] + }, + "options": { + "oneOf": [ + { + "type": "object", + "properties": { + "pixelId": { + "type": "string" + }, + "isInitSkip": { + "type": "boolean" + }, + "params": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "key": { + "type": "string" + }, + "value": {} + }, + "required": [ + "id" + ] + } + } + } + }, + { + "type": "object", + "properties": { + "pixelId": { + "type": "string" + }, + "isInitSkip": { + "type": "boolean" + }, + "params": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "key": { + "type": "string" + }, + "value": {} + }, + "required": [ + "id" + ] + } + }, + "eventType": { + "type": "string", + "enum": [ + "Lead", + "Contact", + "CompleteRegistration", + "Schedule", + "SubmitApplication", + "ViewContent", + "AddPaymentInfo", + "AddToCart", + "AddToWishlist", + "CustomizeProduct", + "Donate", + "FindLocation", + "InitiateCheckout", + "Purchase", + "Search", + "StartTrial", + "Subscribe" + ] + } + }, + "required": [ + "eventType" + ] + }, + { + "type": "object", + "properties": { + "pixelId": { + "type": "string" + }, + "isInitSkip": { + "type": "boolean" + }, + "params": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "key": { + "type": "string" + }, + "value": {} + }, + "required": [ + "id" + ] + } + }, + "eventType": { + "type": "string", + "enum": [ + "Custom" + ] + }, + "name": { + "type": "string" + } + }, + "required": [ + "eventType" + ] + } + ] + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "Zemantic AI" + ] + }, + "blockId": { + "type": "string" + }, + "options": { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "projectId": { + "type": "string" + }, + "systemPrompt": { + "type": "string" + }, + "prompt": { + "type": "string" + }, + "query": { + "type": "string" + }, + "maxResults": { + "type": "integer" + }, + "responseMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "valueToExtract": { + "type": "string", + "enum": [ + "Summary", + "Results" + ] + }, + "variableId": { + "type": "string" + } + }, + "required": [ + "id", + "valueToExtract" + ] + } + } + } + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "openai" + ] + }, + "options": { + "oneOf": [ + { + "type": "object", + "properties": { + "baseUrl": { + "type": "string" + }, + "apiVersion": { + "type": "string" + }, + "credentialsId": { + "type": "string" + } + }, + "description": "Deprecated, use other dedicated OpenAI compatible blocks instead" + }, + { + "type": "object", + "properties": { + "baseUrl": { + "type": "string" + }, + "apiVersion": { + "type": "string" + }, + "credentialsId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Create chat completion" + ] + }, + "model": { + "type": "string" + }, + "messages": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": {} + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "system" + ] + }, + "content": { + "type": "string" + } + }, + "required": [ + "role" + ] + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "user" + ] + }, + "content": { + "type": "string" + } + }, + "required": [ + "role" + ] + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "assistant" + ] + }, + "content": { + "type": "string" + } + }, + "required": [ + "role" + ] + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "Dialogue" + ] + }, + "dialogueVariableId": { + "type": "string" + }, + "startsBy": { + "type": "string", + "enum": [ + "user", + "assistant" + ] + } + }, + "required": [ + "role" + ] + } + ] + } + }, + "tools": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": {} + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "function" + ] + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "parameters": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": {} + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "string" + ] + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "boolean" + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "number" + ] + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "boolean" + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "boolean" + ] + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "boolean" + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "enum" + ] + }, + "values": { + "type": "array", + "items": { + "type": "string" + } + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "boolean" + } + }, + "required": [ + "type" + ] + } + ] + } + }, + "code": { + "type": "string" + } + }, + "required": [ + "type" + ] + } + ] + } + }, + "temperature": { + "anyOf": [ + { + "type": "number" + }, + {} + ] + }, + "responseMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "item": { + "type": "string", + "enum": [ + "Message content", + "Total tokens" + ] + }, + "variableId": { + "type": "string" + } + } + } + } + }, + "required": [ + "action" + ] + }, + { + "type": "object", + "properties": { + "baseUrl": { + "type": "string" + }, + "apiVersion": { + "type": "string" + }, + "credentialsId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Ask Assistant" + ] + }, + "assistantId": { + "type": "string" + }, + "threadId": { + "type": "string" + }, + "message": { + "type": "string" + }, + "functions": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "code": { + "type": "string" + } + } + } + }, + "responseMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "item": { + "type": "string", + "enum": [ + "Message", + "Thread ID" + ] + }, + "variableId": { + "type": "string" + } + } + } + } + }, + "required": [ + "action" + ] + }, + { + "type": "object", + "properties": { + "baseUrl": { + "type": "string" + }, + "apiVersion": { + "type": "string" + }, + "credentialsId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Create speech" + ] + }, + "model": { + "type": "string" + }, + "input": { + "type": "string" + }, + "voice": { + "type": "string", + "enum": [ + "alloy", + "echo", + "fable", + "onyx", + "nova", + "shimmer" + ] + }, + "saveUrlInVariableId": { + "type": "string" + } + }, + "required": [ + "action" + ] + } + ] + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "zemantic-ai" + ] + }, + "options": { + "oneOf": [ + { + "type": "object", + "properties": { + "projectId": { + "type": "string" + }, + "credentialsId": { + "type": "string" + } + } + }, + { + "type": "object", + "properties": { + "projectId": { + "type": "string" + }, + "credentialsId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Search documents" + ] + }, + "query": { + "type": "string" + }, + "maxResults": { + "anyOf": [ + { + "type": "number" + }, + {} + ] + }, + "systemPrompt": { + "type": "string" + }, + "prompt": { + "type": "string" + }, + "responseMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "item": { + "type": "string", + "enum": [ + "Summary", + "Document IDs", + "Texts", + "Scores" + ] + }, + "variableId": { + "type": "string" + } + } + } + } + }, + "required": [ + "action" + ] + } + ] + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "cal-com" + ] + }, + "options": { + "oneOf": [ + { + "type": "object", + "properties": { + "baseUrl": { + "type": "string" + }, + "credentialsId": { + "type": "string" + } + } + }, + { + "type": "object", + "properties": { + "baseUrl": { + "type": "string" + }, + "credentialsId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Book event" + ] + }, + "link": { + "type": "string" + }, + "layout": { + "type": "string", + "enum": [ + "Month", + "Weekly", + "Columns" + ] + }, + "name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "additionalNotes": { + "type": "string" + }, + "phone": { + "type": "string" + }, + "saveBookedDateInVariableId": { + "type": "string" + } + }, + "required": [ + "action" + ] + } + ] + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "chat-node" + ] + }, + "options": { + "oneOf": [ + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + } + } + }, + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Send Message" + ] + }, + "botId": { + "type": "string" + }, + "threadId": { + "type": "string" + }, + "message": { + "type": "string" + }, + "responseMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "item": { + "type": "string", + "enum": [ + "Message", + "Thread ID" + ] + }, + "variableId": { + "type": "string" + } + } + } + } + }, + "required": [ + "action" + ] + } + ] + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "qr-code" + ] + }, + "options": { + "oneOf": [ + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + } + } + }, + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Generate a QR Code" + ] + }, + "data": { + "type": "string" + }, + "saveUrlInVariableId": { + "type": "string" + } + }, + "required": [ + "action" + ] + } + ] + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "dify-ai" + ] + }, + "options": { + "oneOf": [ + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + } + } + }, + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Create Chat Message" + ] + }, + "query": { + "type": "string" + }, + "conversation_id": { + "type": "string" + }, + "user": { + "type": "string" + }, + "inputs": { + "type": "array", + "items": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + }, + "responseMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "item": { + "type": "string", + "enum": [ + "Answer", + "Conversation ID", + "Total Tokens" + ] + }, + "variableId": { + "type": "string" + } + } + } + } + }, + "required": [ + "action" + ] + } + ] + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "mistral" + ] + }, + "options": { + "oneOf": [ + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + } + } + }, + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Create chat completion" + ] + }, + "model": { + "type": "string" + }, + "messages": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": {} + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "system" + ] + }, + "content": { + "type": "string" + } + }, + "required": [ + "role" + ] + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "user" + ] + }, + "content": { + "type": "string" + } + }, + "required": [ + "role" + ] + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "assistant" + ] + }, + "content": { + "type": "string" + } + }, + "required": [ + "role" + ] + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "Dialogue" + ] + }, + "dialogueVariableId": { + "type": "string" + }, + "startsBy": { + "type": "string", + "enum": [ + "user", + "assistant" + ] + } + }, + "required": [ + "role" + ] + } + ] + } + }, + "responseMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "item": { + "type": "string", + "enum": [ + "Message content" + ] + }, + "variableId": { + "type": "string" + } + } + } + } + }, + "required": [ + "action" + ] + } + ] + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "elevenlabs" + ] + }, + "options": { + "oneOf": [ + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + } + } + }, + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Convert text to speech" + ] + }, + "text": { + "type": "string" + }, + "voiceId": { + "type": "string" + }, + "modelId": { + "type": "string" + }, + "saveUrlInVariableId": { + "type": "string" + } + }, + "required": [ + "action" + ] + } + ] + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "anthropic" + ] + }, + "options": { + "oneOf": [ + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + } + } + }, + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Create Chat Message" + ] + }, + "model": { + "type": "string", + "enum": [ + "claude-3-opus-20240229", + "claude-2.1", + "claude-2.0", + "claude-instant-1.2" + ] + }, + "messages": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": {} + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "user" + ] + }, + "content": { + "type": "string" + } + }, + "required": [ + "role" + ] + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "assistant" + ] + }, + "content": { + "type": "string" + } + }, + "required": [ + "role" + ] + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "Dialogue" + ] + }, + "dialogueVariableId": { + "type": "string" + }, + "startsBy": { + "type": "string", + "enum": [ + "user", + "assistant" + ] + } + }, + "required": [ + "role" + ] + } + ] + } + }, + "systemMessage": { + "type": "string" + }, + "temperature": { + "anyOf": [ + { + "type": "number" + }, + {} + ] + }, + "maxTokens": { + "anyOf": [ + { + "type": "number" + }, + {} + ] + }, + "responseMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "item": { + "type": "string", + "enum": [ + "Message Content" + ] + }, + "variableId": { + "type": "string" + } + } + } + } + }, + "required": [ + "action" + ] + } + ] + } + }, + "required": [ + "id", + "type" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "outgoingEdgeId": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "together-ai" + ] + }, + "options": { + "oneOf": [ + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + } + } + }, + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Create chat completion" + ] + }, + "model": { + "type": "string" + }, + "messages": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": {} + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "system" + ] + }, + "content": { + "type": "string" + } + }, + "required": [ + "role" + ] + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "user" + ] + }, + "content": { + "type": "string" + } + }, + "required": [ + "role" + ] + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "assistant" + ] + }, + "content": { + "type": "string" + } + }, + "required": [ + "role" + ] + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "Dialogue" + ] + }, + "dialogueVariableId": { + "type": "string" + }, + "startsBy": { + "type": "string", + "enum": [ + "user", + "assistant" + ] + } + }, + "required": [ + "role" + ] + } + ] + } + }, + "tools": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": {} + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "function" + ] + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "parameters": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": {} + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "string" + ] + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "boolean" + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "number" + ] + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "boolean" + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "boolean" + ] + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "boolean" + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "enum" + ] + }, + "values": { + "type": "array", + "items": { + "type": "string" + } + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "boolean" + } + }, + "required": [ + "type" + ] + } + ] + } + }, + "code": { + "type": "string" + } + }, + "required": [ + "type" + ] + } + ] + } + }, + "temperature": { + "anyOf": [ + { + "type": "number" + }, + {} + ] + }, + "responseMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "item": { + "type": "string", + "enum": [ + "Message content", + "Total tokens" + ] + }, + "variableId": { + "type": "string" + } + } + } + } + }, + "required": [ + "action" + ] + } + ] + } + }, + "required": [ + "id", + "type" ] }, { @@ -9404,20 +10918,296 @@ "type": { "type": "string", "enum": [ - "openai", - "zemantic-ai", - "cal-com", - "chat-node", - "qr-code", - "dify-ai", - "mistral", - "elevenlabs", - "anthropic", - "together-ai", "open-router" ] }, - "options": {} + "options": { + "oneOf": [ + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + } + } + }, + { + "type": "object", + "properties": { + "credentialsId": { + "type": "string" + }, + "action": { + "type": "string", + "enum": [ + "Create chat completion" + ] + }, + "model": { + "type": "string" + }, + "messages": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": {} + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "system" + ] + }, + "content": { + "type": "string" + } + }, + "required": [ + "role" + ] + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "user" + ] + }, + "content": { + "type": "string" + } + }, + "required": [ + "role" + ] + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "assistant" + ] + }, + "content": { + "type": "string" + } + }, + "required": [ + "role" + ] + }, + { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "Dialogue" + ] + }, + "dialogueVariableId": { + "type": "string" + }, + "startsBy": { + "type": "string", + "enum": [ + "user", + "assistant" + ] + } + }, + "required": [ + "role" + ] + } + ] + } + }, + "tools": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": {} + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "function" + ] + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "parameters": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "object", + "properties": {} + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "string" + ] + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "boolean" + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "number" + ] + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "boolean" + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "boolean" + ] + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "boolean" + } + }, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "enum" + ] + }, + "values": { + "type": "array", + "items": { + "type": "string" + } + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "boolean" + } + }, + "required": [ + "type" + ] + } + ] + } + }, + "code": { + "type": "string" + } + }, + "required": [ + "type" + ] + } + ] + } + }, + "temperature": { + "anyOf": [ + { + "type": "number" + }, + {} + ] + }, + "responseMapping": { + "type": "array", + "items": { + "type": "object", + "properties": { + "item": { + "type": "string", + "enum": [ + "Message content", + "Total tokens" + ] + }, + "variableId": { + "type": "string" + } + } + } + } + }, + "required": [ + "action" + ] + } + ] + } }, "required": [ "id", diff --git a/apps/viewer/package.json b/apps/viewer/package.json index 3a0a48335..33af09e51 100644 --- a/apps/viewer/package.json +++ b/apps/viewer/package.json @@ -44,7 +44,6 @@ "@typebot.io/env": "workspace:*", "@typebot.io/forge": "workspace:*", "@typebot.io/forge-repository": "workspace:*", - "@typebot.io/forge-schemas": "workspace:*", "@typebot.io/lib": "workspace:*", "@typebot.io/schemas": "workspace:*", "@typebot.io/tsconfig": "workspace:*", diff --git a/apps/viewer/src/app/api/integrations/openai/streamer/route.ts b/apps/viewer/src/app/api/integrations/openai/streamer/route.ts index 93be0d999..13ad0da60 100644 --- a/apps/viewer/src/app/api/integrations/openai/streamer/route.ts +++ b/apps/viewer/src/app/api/integrations/openai/streamer/route.ts @@ -5,7 +5,7 @@ import { StreamingTextResponse } from 'ai' import OpenAI from 'openai' import { NextResponse } from 'next/dist/server/web/spec-extension/response' import { getBlockById } from '@typebot.io/schemas/helpers' -import { forgedBlocks } from '@typebot.io/forge-schemas' +import { forgedBlocks } from '@typebot.io/forge-repository/definitions' import { decryptV2 } from '@typebot.io/lib/api/encryption/decryptV2' import { ReadOnlyVariableStore } from '@typebot.io/forge' import { @@ -15,6 +15,7 @@ import { import { IntegrationBlockType } from '@typebot.io/schemas/features/blocks/integrations/constants' import { getChatCompletionStream } from '@typebot.io/bot-engine/blocks/integrations/legacy/openai/getChatCompletionStream' import { ChatCompletionOpenAIOptions } from '@typebot.io/schemas/features/blocks/integrations/openai/schema' +import { isForgedBlockType } from '@typebot.io/schemas/features/blocks/forged/helpers' export const runtime = 'edge' export const preferredRegion = 'lhr1' @@ -109,7 +110,13 @@ export async function POST(req: Request) { } } } - const blockDef = forgedBlocks.find((b) => b.id === block.type) + if (!isForgedBlockType(block.type)) + return NextResponse.json( + { message: 'Invalid forged block id' }, + { status: 400, headers: responseHeaders } + ) + + const blockDef = forgedBlocks[block.type] const action = blockDef?.actions.find((a) => a.name === block.options?.action) if (!action || !action.run?.stream) diff --git a/packages/bot-engine/continueBotFlow.ts b/packages/bot-engine/continueBotFlow.ts index b1f7538e6..8358b5cb3 100644 --- a/packages/bot-engine/continueBotFlow.ts +++ b/packages/bot-engine/continueBotFlow.ts @@ -36,13 +36,14 @@ import { defaultPictureChoiceOptions } from '@typebot.io/schemas/features/blocks import { defaultFileInputOptions } from '@typebot.io/schemas/features/blocks/inputs/file/constants' import { VisitedEdge } from '@typebot.io/prisma' import { getBlockById } from '@typebot.io/schemas/helpers' -import { ForgedBlock, forgedBlocks } from '@typebot.io/forge-schemas' -import { enabledBlocks } from '@typebot.io/forge-repository' +import { ForgedBlock } from '@typebot.io/forge-repository/types' +import { forgedBlocks } from '@typebot.io/forge-repository/definitions' import { resumeChatCompletion } from './blocks/integrations/legacy/openai/resumeChatCompletion' import { env } from '@typebot.io/env' import { downloadMedia } from './whatsapp/downloadMedia' import { uploadFileToBucket } from '@typebot.io/lib/s3/uploadFileToBucket' import { isURL } from '@typebot.io/lib/validators/isURL' +import { isForgedBlockType } from '@typebot.io/schemas/features/blocks/forged/helpers' type Params = { version: 1 | 2 @@ -111,14 +112,12 @@ export const continueBotFlow = async ( response: JSON.parse(reply), }) if (result.newSessionState) newSessionState = result.newSessionState - } else if ( - enabledBlocks.includes(block.type as (typeof enabledBlocks)[number]) - ) { + } else if (isForgedBlockType(block.type)) { if (reply) { const options = (block as ForgedBlock).options - const action = forgedBlocks - .find((b) => b.id === block.type) - ?.actions.find((a) => a.name === options?.action) + const action = forgedBlocks[block.type].actions.find( + (a) => a.name === options?.action + ) if (action) { if (action.run?.stream?.getStreamVariableId) { firstBubbleWasStreamed = true diff --git a/packages/bot-engine/forge/executeForgedBlock.ts b/packages/bot-engine/forge/executeForgedBlock.ts index 0d9122912..90937f23d 100644 --- a/packages/bot-engine/forge/executeForgedBlock.ts +++ b/packages/bot-engine/forge/executeForgedBlock.ts @@ -1,5 +1,6 @@ import { VariableStore, LogsStore } from '@typebot.io/forge' -import { ForgedBlock, forgedBlocks } from '@typebot.io/forge-schemas' +import { forgedBlocks } from '@typebot.io/forge-repository/definitions' +import { ForgedBlock } from '@typebot.io/forge-repository/types' import { decrypt } from '@typebot.io/lib/api/encryption/decrypt' import { isPlaneteScale } from '@typebot.io/lib/isPlanetScale' import prisma from '@typebot.io/lib/prisma' @@ -23,7 +24,7 @@ export const executeForgedBlock = async ( state: SessionState, block: ForgedBlock ): Promise => { - const blockDef = forgedBlocks.find((b) => b.id === block.type) + const blockDef = forgedBlocks[block.type] if (!blockDef) return { outgoingEdgeId: block.outgoingEdgeId } const action = blockDef.actions.find((a) => a.name === block.options.action) const noCredentialsError = { diff --git a/packages/bot-engine/package.json b/packages/bot-engine/package.json index 7b35acba3..33a568074 100644 --- a/packages/bot-engine/package.json +++ b/packages/bot-engine/package.json @@ -36,7 +36,6 @@ "devDependencies": { "@typebot.io/forge": "workspace:*", "@typebot.io/forge-repository": "workspace:*", - "@typebot.io/forge-schemas": "workspace:*", "@types/nodemailer": "6.4.8", "@types/qs": "6.9.7" } diff --git a/packages/embeds/js/package.json b/packages/embeds/js/package.json index 44e48d934..834267369 100644 --- a/packages/embeds/js/package.json +++ b/packages/embeds/js/package.json @@ -26,7 +26,6 @@ "@rollup/plugin-babel": "6.0.3", "@rollup/plugin-node-resolve": "15.1.0", "@rollup/plugin-terser": "0.4.3", - "@rollup/plugin-typescript": "11.1.2", "@typebot.io/bot-engine": "workspace:*", "@typebot.io/env": "workspace:*", "@typebot.io/lib": "workspace:*", diff --git a/packages/embeds/js/rollup.config.js b/packages/embeds/js/rollup.config.js index 199042a26..5d88f2916 100644 --- a/packages/embeds/js/rollup.config.js +++ b/packages/embeds/js/rollup.config.js @@ -4,11 +4,15 @@ import { babel } from '@rollup/plugin-babel' import postcss from 'rollup-plugin-postcss' import autoprefixer from 'autoprefixer' import tailwindcss from 'tailwindcss' -import typescript from '@rollup/plugin-typescript' import { typescriptPaths } from 'rollup-plugin-typescript-paths' +import fs from 'fs' const extensions = ['.ts', '.tsx'] +const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8')) +const packageVersion = packageJson.version +const preamble = `// v${packageVersion}` + const indexConfig = { input: './src/index.ts', output: { @@ -23,6 +27,7 @@ const indexConfig = { presets: ['solid', '@babel/preset-typescript'], extensions, }), + typescriptPaths({ preserveExtensions: true }), postcss({ plugins: [autoprefixer(), tailwindcss()], extract: false, @@ -31,9 +36,9 @@ const indexConfig = { minimize: true, inject: false, }), - typescript(), - typescriptPaths({ preserveExtensions: true }), - terser({ output: { comments: false } }), + terser({ + format: { preamble }, + }), ], } diff --git a/packages/embeds/js/src/components/Bot.tsx b/packages/embeds/js/src/components/Bot.tsx index 901cfacb5..6e4896fc5 100644 --- a/packages/embeds/js/src/components/Bot.tsx +++ b/packages/embeds/js/src/components/Bot.tsx @@ -15,8 +15,7 @@ import { } from '@/utils/storage' import { setCssVariablesValue } from '@/utils/setCssVariablesValue' import immutableCss from '../assets/immutable.css' -import { Font, InputBlock } from '@typebot.io/schemas' -import { StartFrom } from '@typebot.io/schemas' +import { Font, InputBlock, StartFrom } from '@typebot.io/schemas' import { defaultTheme } from '@typebot.io/schemas/features/typebot/theme/constants' import { clsx } from 'clsx' import { HTTPError } from 'ky' diff --git a/packages/embeds/nextjs/package.json b/packages/embeds/nextjs/package.json index 09715d5c7..803bf9a73 100644 --- a/packages/embeds/nextjs/package.json +++ b/packages/embeds/nextjs/package.json @@ -20,7 +20,6 @@ "@rollup/plugin-babel": "6.0.3", "@rollup/plugin-node-resolve": "15.1.0", "@rollup/plugin-terser": "0.4.3", - "@rollup/plugin-typescript": "11.1.2", "@typebot.io/js": "workspace:*", "@typebot.io/lib": "workspace:*", "@typebot.io/prisma": "workspace:*", diff --git a/packages/embeds/nextjs/rollup.config.js b/packages/embeds/nextjs/rollup.config.js index 7a7f41443..84e77a056 100644 --- a/packages/embeds/nextjs/rollup.config.js +++ b/packages/embeds/nextjs/rollup.config.js @@ -1,11 +1,15 @@ import resolve from '@rollup/plugin-node-resolve' import terser from '@rollup/plugin-terser' import { babel } from '@rollup/plugin-babel' -import typescript from '@rollup/plugin-typescript' import { typescriptPaths } from 'rollup-plugin-typescript-paths' +import fs from 'fs' const extensions = ['.ts', '.tsx'] +const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8')) +const packageVersion = packageJson.version +const preamble = `// v${packageVersion}` + const indexConfig = { input: './src/index.ts', output: { @@ -21,9 +25,8 @@ const indexConfig = { presets: ['@babel/preset-react', '@babel/preset-typescript'], extensions, }), - typescript(), typescriptPaths({ preserveExtensions: true }), - terser({ output: { comments: false } }), + terser({ format: { preamble } }), ], } diff --git a/packages/embeds/react/package.json b/packages/embeds/react/package.json index 700dcbc21..92e663bb2 100644 --- a/packages/embeds/react/package.json +++ b/packages/embeds/react/package.json @@ -25,7 +25,6 @@ "@rollup/plugin-babel": "6.0.3", "@rollup/plugin-node-resolve": "15.1.0", "@rollup/plugin-terser": "0.4.3", - "@rollup/plugin-typescript": "11.1.2", "@typebot.io/js": "workspace:*", "@typebot.io/lib": "workspace:*", "@typebot.io/prisma": "workspace:*", diff --git a/packages/embeds/react/rollup.config.js b/packages/embeds/react/rollup.config.js index 014135e39..344c88a79 100644 --- a/packages/embeds/react/rollup.config.js +++ b/packages/embeds/react/rollup.config.js @@ -1,11 +1,15 @@ import resolve from '@rollup/plugin-node-resolve' import terser from '@rollup/plugin-terser' import { babel } from '@rollup/plugin-babel' -import typescript from '@rollup/plugin-typescript' import { typescriptPaths } from 'rollup-plugin-typescript-paths' +import fs from 'fs' const extensions = ['.ts', '.tsx'] +const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8')) +const packageVersion = packageJson.version +const preamble = `// v${packageVersion}` + const indexConfig = { input: './src/index.ts', output: { @@ -21,9 +25,8 @@ const indexConfig = { presets: ['@babel/preset-react', '@babel/preset-typescript'], extensions, }), - typescript(), typescriptPaths({ preserveExtensions: true }), - terser({ output: { comments: false } }), + terser({ format: { preamble } }), ], } diff --git a/packages/forge/blocks/anthropic/actions/createChatMessage.tsx b/packages/forge/blocks/anthropic/actions/createChatMessage.tsx index dfb9d2c4d..26c366605 100644 --- a/packages/forge/blocks/anthropic/actions/createChatMessage.tsx +++ b/packages/forge/blocks/anthropic/actions/createChatMessage.tsx @@ -90,15 +90,15 @@ export const createChatMessage = createAction({ options, turnableInto: [ { - blockType: 'mistral', + blockId: 'mistral', transform: transformToChatCompletionOptions, }, { - blockType: 'openai', + blockId: 'openai', transform: transformToChatCompletionOptions, }, - { blockType: 'open-router', transform: transformToChatCompletionOptions }, - { blockType: 'together-ai', transform: transformToChatCompletionOptions }, + { blockId: 'open-router', transform: transformToChatCompletionOptions }, + { blockId: 'together-ai', transform: transformToChatCompletionOptions }, ], getSetVariableIds: ({ responseMapping }) => responseMapping?.map((res) => res.variableId).filter(isDefined) ?? [], diff --git a/packages/forge/blocks/anthropic/index.ts b/packages/forge/blocks/anthropic/index.ts index 864000964..1ea3cac94 100644 --- a/packages/forge/blocks/anthropic/index.ts +++ b/packages/forge/blocks/anthropic/index.ts @@ -3,7 +3,7 @@ import { AnthropicLogo } from './logo' import { auth } from './auth' import { createChatMessage } from './actions/createChatMessage' -export const anthropic = createBlock({ +export const anthropicBlock = createBlock({ id: 'anthropic', name: 'Anthropic', tags: ['ai', 'chat', 'completion', 'claude', 'anthropic'], diff --git a/packages/forge/blocks/anthropic/schemas.ts b/packages/forge/blocks/anthropic/schemas.ts new file mode 100644 index 000000000..a074e92f6 --- /dev/null +++ b/packages/forge/blocks/anthropic/schemas.ts @@ -0,0 +1,6 @@ +// Do not edit this file manually +import { parseBlockCredentials, parseBlockSchema } from '@typebot.io/forge' +import { anthropicBlock } from '.' + +export const anthropicBlockSchema = parseBlockSchema(anthropicBlock) +export const anthropicCredentialsSchema = parseBlockCredentials(anthropicBlock) diff --git a/packages/forge/blocks/calCom/index.ts b/packages/forge/blocks/calCom/index.ts index d96541934..1d7efa429 100644 --- a/packages/forge/blocks/calCom/index.ts +++ b/packages/forge/blocks/calCom/index.ts @@ -3,7 +3,7 @@ import { CalComLogo } from './logo' import { bookEvent } from './actions/bookEvent' import { baseOptions } from './baseOptions' -export const calCom = createBlock({ +export const calComBlock = createBlock({ id: 'cal-com', name: 'Cal.com', tags: ['calendar', 'scheduling', 'meetings'], diff --git a/packages/forge/blocks/calCom/schemas.ts b/packages/forge/blocks/calCom/schemas.ts new file mode 100644 index 000000000..ec7288b29 --- /dev/null +++ b/packages/forge/blocks/calCom/schemas.ts @@ -0,0 +1,6 @@ +// Do not edit this file manually +import { parseBlockCredentials, parseBlockSchema } from '@typebot.io/forge' +import { calComBlock } from '.' + +export const calComBlockSchema = parseBlockSchema(calComBlock) +export const calComCredentialsSchema = parseBlockCredentials(calComBlock) diff --git a/packages/forge/blocks/chatNode/index.ts b/packages/forge/blocks/chatNode/index.ts index 6a8c9029e..f50010214 100644 --- a/packages/forge/blocks/chatNode/index.ts +++ b/packages/forge/blocks/chatNode/index.ts @@ -3,7 +3,7 @@ import { ChatNodeLogo } from './logo' import { auth } from './auth' import { sendMessage } from './actions/sendMessage' -export const chatNode = createBlock({ +export const chatNodeBlock = createBlock({ id: 'chat-node', name: 'ChatNode', tags: ['ai', 'openai', 'document', 'url'], diff --git a/packages/forge/blocks/chatNode/schemas.ts b/packages/forge/blocks/chatNode/schemas.ts new file mode 100644 index 000000000..21a1fdb19 --- /dev/null +++ b/packages/forge/blocks/chatNode/schemas.ts @@ -0,0 +1,6 @@ +// Do not edit this file manually +import { parseBlockCredentials, parseBlockSchema } from '@typebot.io/forge' +import { chatNodeBlock } from '.' + +export const chatNodeBlockSchema = parseBlockSchema(chatNodeBlock) +export const chatNodeCredentialsSchema = parseBlockCredentials(chatNodeBlock) diff --git a/packages/forge/blocks/difyAi/index.ts b/packages/forge/blocks/difyAi/index.ts index 66b87c673..4c717340e 100644 --- a/packages/forge/blocks/difyAi/index.ts +++ b/packages/forge/blocks/difyAi/index.ts @@ -3,7 +3,7 @@ import { DifyAiLogo } from './logo' import { auth } from './auth' import { createChatMessage } from './actions/createChatMessage' -export const difyAi = createBlock({ +export const difyAiBlock = createBlock({ id: 'dify-ai', name: 'Dify.AI', tags: ['dify', 'ai', 'documents', 'files', 'knowledge base'], diff --git a/packages/forge/blocks/difyAi/schemas.ts b/packages/forge/blocks/difyAi/schemas.ts new file mode 100644 index 000000000..912f1b09b --- /dev/null +++ b/packages/forge/blocks/difyAi/schemas.ts @@ -0,0 +1,6 @@ +// Do not edit this file manually +import { parseBlockCredentials, parseBlockSchema } from '@typebot.io/forge' +import { difyAiBlock } from '.' + +export const difyAiBlockSchema = parseBlockSchema(difyAiBlock) +export const difyAiCredentialsSchema = parseBlockCredentials(difyAiBlock) diff --git a/packages/forge/blocks/elevenlabs/index.ts b/packages/forge/blocks/elevenlabs/index.ts index c186c6223..223f85b1c 100644 --- a/packages/forge/blocks/elevenlabs/index.ts +++ b/packages/forge/blocks/elevenlabs/index.ts @@ -3,7 +3,7 @@ import { ElevenlabsLogo, ElevenlabsLogoDark } from './logo' import { auth } from './auth' import { convertTextToSpeech } from './actions/convertTextToSpeech' -export const elevenlabs = createBlock({ +export const elevenlabsBlock = createBlock({ id: 'elevenlabs', name: 'ElevenLabs', tags: ['ai', 'voice', 'generation'], diff --git a/packages/forge/blocks/elevenlabs/schemas.ts b/packages/forge/blocks/elevenlabs/schemas.ts new file mode 100644 index 000000000..886b14af2 --- /dev/null +++ b/packages/forge/blocks/elevenlabs/schemas.ts @@ -0,0 +1,7 @@ +// Do not edit this file manually +import { parseBlockCredentials, parseBlockSchema } from '@typebot.io/forge' +import { elevenlabsBlock } from '.' + +export const elevenlabsBlockSchema = parseBlockSchema(elevenlabsBlock) +export const elevenlabsCredentialsSchema = + parseBlockCredentials(elevenlabsBlock) diff --git a/packages/forge/blocks/mistral/actions/createChatCompletion.ts b/packages/forge/blocks/mistral/actions/createChatCompletion.ts index c7c9836cc..ad2fa6a34 100644 --- a/packages/forge/blocks/mistral/actions/createChatCompletion.ts +++ b/packages/forge/blocks/mistral/actions/createChatCompletion.ts @@ -69,14 +69,14 @@ export const createChatCompletion = createAction({ options, turnableInto: [ { - blockType: 'openai', + blockId: 'openai', }, { - blockType: 'together-ai', + blockId: 'together-ai', }, - { blockType: 'open-router' }, + { blockId: 'open-router' }, { - blockType: 'anthropic', + blockId: 'anthropic', transform: (options) => ({ ...options, action: 'Create Chat Message', diff --git a/packages/forge/blocks/mistral/index.ts b/packages/forge/blocks/mistral/index.ts index 5469de3de..a3fbfbb79 100644 --- a/packages/forge/blocks/mistral/index.ts +++ b/packages/forge/blocks/mistral/index.ts @@ -3,7 +3,7 @@ import { MistralLogo } from './logo' import { auth } from './auth' import { createChatCompletion } from './actions/createChatCompletion' -export const mistral = createBlock({ +export const mistralBlock = createBlock({ id: 'mistral', name: 'Mistral', tags: ['ai', 'chat', 'completion'], diff --git a/packages/forge/blocks/mistral/schemas.ts b/packages/forge/blocks/mistral/schemas.ts new file mode 100644 index 000000000..5cb7159f5 --- /dev/null +++ b/packages/forge/blocks/mistral/schemas.ts @@ -0,0 +1,6 @@ +// Do not edit this file manually +import { parseBlockCredentials, parseBlockSchema } from '@typebot.io/forge' +import { mistralBlock } from '.' + +export const mistralBlockSchema = parseBlockSchema(mistralBlock) +export const mistralCredentialsSchema = parseBlockCredentials(mistralBlock) diff --git a/packages/forge/blocks/openRouter/actions/createChatCompletion.tsx b/packages/forge/blocks/openRouter/actions/createChatCompletion.tsx index fd9554fef..5b3a7c909 100644 --- a/packages/forge/blocks/openRouter/actions/createChatCompletion.tsx +++ b/packages/forge/blocks/openRouter/actions/createChatCompletion.tsx @@ -14,14 +14,14 @@ export const createChatCompletion = createAction({ auth, turnableInto: [ { - blockType: 'openai', + blockId: 'openai', }, { - blockType: 'together-ai', + blockId: 'together-ai', }, - { blockType: 'mistral' }, + { blockId: 'mistral' }, { - blockType: 'anthropic', + blockId: 'anthropic', transform: (options) => ({ ...options, action: 'Create Chat Message', diff --git a/packages/forge/blocks/openRouter/index.ts b/packages/forge/blocks/openRouter/index.ts index 8d671a9c9..531bd91a1 100644 --- a/packages/forge/blocks/openRouter/index.ts +++ b/packages/forge/blocks/openRouter/index.ts @@ -3,7 +3,7 @@ import { OpenRouterLogo } from './logo' import { auth } from './auth' import { createChatCompletion } from './actions/createChatCompletion' -export const openRouter = createBlock({ +export const openRouterBlock = createBlock({ id: 'open-router', name: 'OpenRouter', tags: ['ai', 'openai', 'chat', 'completion'], diff --git a/packages/forge/blocks/openRouter/schemas.ts b/packages/forge/blocks/openRouter/schemas.ts new file mode 100644 index 000000000..4b04875e4 --- /dev/null +++ b/packages/forge/blocks/openRouter/schemas.ts @@ -0,0 +1,7 @@ +// Do not edit this file manually +import { parseBlockCredentials, parseBlockSchema } from '@typebot.io/forge' +import { openRouterBlock } from '.' + +export const openRouterBlockSchema = parseBlockSchema(openRouterBlock) +export const openRouterCredentialsSchema = + parseBlockCredentials(openRouterBlock) diff --git a/packages/forge/blocks/openai/actions/createChatCompletion.tsx b/packages/forge/blocks/openai/actions/createChatCompletion.tsx index 20e7db840..663576fed 100644 --- a/packages/forge/blocks/openai/actions/createChatCompletion.tsx +++ b/packages/forge/blocks/openai/actions/createChatCompletion.tsx @@ -21,14 +21,14 @@ export const createChatCompletion = createAction({ getSetVariableIds: getChatCompletionSetVarIds, turnableInto: [ { - blockType: 'open-router', + blockId: 'open-router', }, { - blockType: 'together-ai', + blockId: 'together-ai', }, - { blockType: 'mistral' }, + { blockId: 'mistral' }, { - blockType: 'anthropic', + blockId: 'anthropic', transform: (options) => ({ ...options, action: 'Create Chat Message', diff --git a/packages/forge/blocks/openai/schemas.ts b/packages/forge/blocks/openai/schemas.ts new file mode 100644 index 000000000..625dcfb94 --- /dev/null +++ b/packages/forge/blocks/openai/schemas.ts @@ -0,0 +1,6 @@ +// Do not edit this file manually +import { parseBlockCredentials, parseBlockSchema } from '@typebot.io/forge' +import { openAIBlock } from '.' + +export const openAIBlockSchema = parseBlockSchema(openAIBlock) +export const openAICredentialsSchema = parseBlockCredentials(openAIBlock) diff --git a/packages/forge/blocks/qrcode/index.ts b/packages/forge/blocks/qrcode/index.ts index 99687d8e0..11f8584ac 100644 --- a/packages/forge/blocks/qrcode/index.ts +++ b/packages/forge/blocks/qrcode/index.ts @@ -2,7 +2,7 @@ import { createBlock } from '@typebot.io/forge' import { QrCodeLogo } from './logo' import { generateQrCode } from './actions/generateQrCodeImage' -export const qrCode = createBlock({ +export const qrCodeBlock = createBlock({ id: 'qr-code', name: 'QR code', tags: [], diff --git a/packages/forge/blocks/qrcode/schemas.ts b/packages/forge/blocks/qrcode/schemas.ts new file mode 100644 index 000000000..0a9149f26 --- /dev/null +++ b/packages/forge/blocks/qrcode/schemas.ts @@ -0,0 +1,6 @@ +// Do not edit this file manually +import { parseBlockCredentials, parseBlockSchema } from '@typebot.io/forge' +import { qrCodeBlock } from '.' + +export const qrCodeBlockSchema = parseBlockSchema(qrCodeBlock) +export const qrCodeCredentialsSchema = parseBlockCredentials(qrCodeBlock) diff --git a/packages/forge/blocks/togetherAi/actions/createChatCompletion.tsx b/packages/forge/blocks/togetherAi/actions/createChatCompletion.tsx index 1e4b97cbe..1ceefe686 100644 --- a/packages/forge/blocks/togetherAi/actions/createChatCompletion.tsx +++ b/packages/forge/blocks/togetherAi/actions/createChatCompletion.tsx @@ -16,14 +16,14 @@ export const createChatCompletion = createAction({ }), turnableInto: [ { - blockType: 'openai', + blockId: 'openai', }, { - blockType: 'open-router', + blockId: 'open-router', }, - { blockType: 'mistral' }, + { blockId: 'mistral' }, { - blockType: 'anthropic', + blockId: 'anthropic', transform: (options) => ({ ...options, action: 'Create Chat Message', diff --git a/packages/forge/blocks/togetherAi/index.ts b/packages/forge/blocks/togetherAi/index.ts index 5d577d512..72f88a860 100644 --- a/packages/forge/blocks/togetherAi/index.ts +++ b/packages/forge/blocks/togetherAi/index.ts @@ -3,7 +3,7 @@ import { TogetherAiLogo } from './logo' import { auth } from './auth' import { createChatCompletion } from './actions/createChatCompletion' -export const togetherAi = createBlock({ +export const togetherAiBlock = createBlock({ id: 'together-ai', name: 'Together', fullName: 'Together AI', diff --git a/packages/forge/blocks/togetherAi/schemas.ts b/packages/forge/blocks/togetherAi/schemas.ts new file mode 100644 index 000000000..3d569cdf1 --- /dev/null +++ b/packages/forge/blocks/togetherAi/schemas.ts @@ -0,0 +1,7 @@ +// Do not edit this file manually +import { parseBlockCredentials, parseBlockSchema } from '@typebot.io/forge' +import { togetherAiBlock } from '.' + +export const togetherAiBlockSchema = parseBlockSchema(togetherAiBlock) +export const togetherAiCredentialsSchema = + parseBlockCredentials(togetherAiBlock) diff --git a/packages/forge/blocks/zemanticAi/index.ts b/packages/forge/blocks/zemanticAi/index.ts index 94ba4f749..20c501d54 100644 --- a/packages/forge/blocks/zemanticAi/index.ts +++ b/packages/forge/blocks/zemanticAi/index.ts @@ -5,7 +5,7 @@ import { searchDocuments } from './actions/searchDocuments' import { auth } from './auth' import { baseOptions } from './baseOptions' -export const zemanticAi = createBlock({ +export const zemanticAiBlock = createBlock({ id: 'zemantic-ai', name: 'Zemantic AI', tags: [], diff --git a/packages/forge/blocks/zemanticAi/schemas.ts b/packages/forge/blocks/zemanticAi/schemas.ts new file mode 100644 index 000000000..20c16cb40 --- /dev/null +++ b/packages/forge/blocks/zemanticAi/schemas.ts @@ -0,0 +1,7 @@ +// Do not edit this file manually +import { parseBlockCredentials, parseBlockSchema } from '@typebot.io/forge' +import { zemanticAiBlock } from '.' + +export const zemanticAiBlockSchema = parseBlockSchema(zemanticAiBlock) +export const zemanticAiCredentialsSchema = + parseBlockCredentials(zemanticAiBlock) diff --git a/packages/forge/cli/index.ts b/packages/forge/cli/index.ts index 92e51acbe..ba28120a9 100644 --- a/packages/forge/cli/index.ts +++ b/packages/forge/cli/index.ts @@ -83,7 +83,7 @@ const main = async () => { await createIndexFile(newBlockPath, prompt) await createLogoFile(newBlockPath, prompt) if (prompt.auth !== 'none') await createAuthFile(newBlockPath, prompt) - await addNewIntegrationToRepository(prompt) + await createSchemasFile(newBlockPath, prompt) s.stop('Creating files...') s.start('Installing dependencies...') await new Promise((resolve, reject) => { @@ -138,7 +138,7 @@ const createIndexFile = async ( import { ${capitalize(camelCaseId)}Logo } from './logo' ${auth !== 'none' ? `import { auth } from './auth'` : ''} -export const ${camelCaseName} = createBlock({ +export const ${camelCaseName}Block = createBlock({ id: '${id}', name: '${name}', tags: [], @@ -175,51 +175,6 @@ const createPackageJson = async (path: string, { id }: { id: unknown }) => { ) } -const addNewIntegrationToRepository = async ({ - camelCaseId, - id, -}: { - camelCaseId: string - id: string -}) => { - const schemasPath = join(process.cwd(), `../schemas`) - const packageJson = require(join(schemasPath, 'package.json')) - packageJson.devDependencies[`@typebot.io/${id}-block`] = 'workspace:*' - writeFileSync( - join(schemasPath, 'package.json'), - await prettier.format(JSON.stringify(packageJson, null, 2), { - parser: 'json', - ...prettierRc, - }) - ) - const repoIndexFile = readFileSync(join(schemasPath, 'index.ts')).toString() - writeFileSync( - join(schemasPath, 'index.ts'), - await prettier.format( - repoIndexFile - .replace( - '] as BlockDefinition<(typeof enabledBlocks)[number], any, any>[]', - `${camelCaseId},] as BlockDefinition<(typeof enabledBlocks)[number], any, any>[]` - ) - .replace( - '// Do not edit this file manually', - `// Do not edit this file manually\nimport {${camelCaseId}} from '@typebot.io/${id}-block'` - ), - { parser: 'typescript', ...prettierRc } - ) - ) - - const repoPath = join(process.cwd(), `../repository`) - const enabledIndexFile = readFileSync(join(repoPath, 'index.ts')).toString() - writeFileSync( - join(repoPath, 'index.ts'), - await prettier.format( - enabledIndexFile.replace('] as const', `'${id}'] as const`), - { parser: 'typescript', ...prettierRc } - ) - ) -} - const createTsConfig = async (path: string) => { writeFileSync( join(path, 'tsconfig.json'), @@ -289,6 +244,27 @@ const createAuthFile = async ( ) ) +const createSchemasFile = async ( + path: string, + { + id, + }: { id: string; name: string; auth: 'apiKey' | 'encryptedData' | 'none' } +) => { + const camelCaseName = camelize(id as string) + writeFileSync( + join(path, 'schemas.ts'), + await prettier.format( + `// Do not edit this file manually +import { parseBlockCredentials, parseBlockSchema } from '@typebot.io/forge' +import { ${camelCaseName}Block } from '.' + +export const ${camelCaseName}BlockSchema = parseBlockSchema(${camelCaseName}Block) +export const ${camelCaseName}CredentialsSchema = parseBlockCredentials(${camelCaseName}Block)`, + { parser: 'typescript', ...prettierRc } + ) + ) +} + main() .then() .catch((err) => { diff --git a/packages/forge/core/index.ts b/packages/forge/core/index.ts index 3e1163504..eafddba43 100644 --- a/packages/forge/core/index.ts +++ b/packages/forge/core/index.ts @@ -89,7 +89,7 @@ export const parseBlockCredentials = < >( blockDefinition: BlockDefinition ) => { - if (!blockDefinition.auth) throw new Error('Block has no auth definition') + if (!blockDefinition.auth) return null return z.object({ id: z.string(), type: z.literal(blockDefinition.id), diff --git a/packages/forge/core/package.json b/packages/forge/core/package.json index 36a394490..173ff867c 100644 --- a/packages/forge/core/package.json +++ b/packages/forge/core/package.json @@ -11,7 +11,6 @@ }, "devDependencies": { "@typebot.io/tsconfig": "workspace:*", - "@types/react": "18.2.15", - "@typebot.io/forge-repository": "workspace:*" + "@types/react": "18.2.15" } } diff --git a/packages/forge/core/types.ts b/packages/forge/core/types.ts index 490383178..1f0008397 100644 --- a/packages/forge/core/types.ts +++ b/packages/forge/core/types.ts @@ -1,7 +1,6 @@ import { SVGProps } from 'react' import { z } from './zod' import { ZodRawShape } from 'zod' -import { enabledBlocks } from '@typebot.io/forge-repository' export type VariableStore = { get: (variableId: string) => string | (string | null)[] | null | undefined @@ -34,7 +33,7 @@ export type FunctionToExecute = { export type ReadOnlyVariableStore = Omit export type TurnableIntoParam = { - blockType: (typeof enabledBlocks)[number] + blockId: string /** * If defined will be used to convert the existing block options into the new block options. */ diff --git a/packages/forge/repository/index.ts b/packages/forge/repository/constants.ts similarity index 58% rename from packages/forge/repository/index.ts rename to packages/forge/repository/constants.ts index a81afcec1..00b80c788 100644 --- a/packages/forge/repository/index.ts +++ b/packages/forge/repository/constants.ts @@ -1,5 +1,6 @@ -// Do not edit this file manually -export const enabledBlocks = [ +import { ForgedBlock } from './types' + +export const forgedBlockIds = [ 'openai', 'zemantic-ai', 'cal-com', @@ -11,4 +12,4 @@ export const enabledBlocks = [ 'anthropic', 'together-ai', 'open-router', -] as const +] as const satisfies ForgedBlock['type'][] diff --git a/packages/forge/repository/credentials.ts b/packages/forge/repository/credentials.ts new file mode 100644 index 000000000..ab9e6996c --- /dev/null +++ b/packages/forge/repository/credentials.ts @@ -0,0 +1,36 @@ +import { anthropicBlock } from '@typebot.io/anthropic-block' +import { anthropicCredentialsSchema } from '@typebot.io/anthropic-block/schemas' +import { calComBlock } from '@typebot.io/cal-com-block' +import { calComCredentialsSchema } from '@typebot.io/cal-com-block/schemas' +import { chatNodeBlock } from '@typebot.io/chat-node-block' +import { chatNodeCredentialsSchema } from '@typebot.io/chat-node-block/schemas' +import { difyAiBlock } from '@typebot.io/dify-ai-block' +import { difyAiCredentialsSchema } from '@typebot.io/dify-ai-block/schemas' +import { elevenlabsBlock } from '@typebot.io/elevenlabs-block' +import { elevenlabsCredentialsSchema } from '@typebot.io/elevenlabs-block/schemas' +import { mistralBlock } from '@typebot.io/mistral-block' +import { mistralCredentialsSchema } from '@typebot.io/mistral-block/schemas' +import { openRouterBlock } from '@typebot.io/open-router-block' +import { openRouterCredentialsSchema } from '@typebot.io/open-router-block/schemas' +import { openAIBlock } from '@typebot.io/openai-block' +import { openAICredentialsSchema } from '@typebot.io/openai-block/schemas' +import { qrCodeBlock } from '@typebot.io/qrcode-block' +import { qrCodeCredentialsSchema } from '@typebot.io/qrcode-block/schemas' +import { togetherAiBlock } from '@typebot.io/together-ai-block' +import { togetherAiCredentialsSchema } from '@typebot.io/together-ai-block/schemas' +import { zemanticAiBlock } from '@typebot.io/zemantic-ai-block' +import { zemanticAiCredentialsSchema } from '@typebot.io/zemantic-ai-block/schemas' + +export const forgedCredentialsSchemas = { + [openAIBlock.id]: openAICredentialsSchema, + [zemanticAiBlock.id]: zemanticAiCredentialsSchema, + [calComBlock.id]: calComCredentialsSchema, + [chatNodeBlock.id]: chatNodeCredentialsSchema, + [qrCodeBlock.id]: qrCodeCredentialsSchema, + [difyAiBlock.id]: difyAiCredentialsSchema, + [mistralBlock.id]: mistralCredentialsSchema, + [elevenlabsBlock.id]: elevenlabsCredentialsSchema, + [anthropicBlock.id]: anthropicCredentialsSchema, + [togetherAiBlock.id]: togetherAiCredentialsSchema, + [openRouterBlock.id]: openRouterCredentialsSchema, +} diff --git a/packages/forge/repository/definitions.ts b/packages/forge/repository/definitions.ts new file mode 100644 index 000000000..b467b5056 --- /dev/null +++ b/packages/forge/repository/definitions.ts @@ -0,0 +1,26 @@ +// Do not edit this file manually +import { anthropicBlock } from '@typebot.io/anthropic-block' +import { openRouterBlock } from '@typebot.io/open-router-block' +import { togetherAiBlock } from '@typebot.io/together-ai-block' +import { elevenlabsBlock } from '@typebot.io/elevenlabs-block' +import { difyAiBlock } from '@typebot.io/dify-ai-block' +import { mistralBlock } from '@typebot.io/mistral-block' +import { qrCodeBlock } from '@typebot.io/qrcode-block' +import { chatNodeBlock } from '@typebot.io/chat-node-block' +import { calComBlock } from '@typebot.io/cal-com-block' +import { zemanticAiBlock } from '@typebot.io/zemantic-ai-block' +import { openAIBlock } from '@typebot.io/openai-block' + +export const forgedBlocks = { + [openAIBlock.id]: openAIBlock, + [zemanticAiBlock.id]: zemanticAiBlock, + [calComBlock.id]: calComBlock, + [chatNodeBlock.id]: chatNodeBlock, + [qrCodeBlock.id]: qrCodeBlock, + [difyAiBlock.id]: difyAiBlock, + [mistralBlock.id]: mistralBlock, + [elevenlabsBlock.id]: elevenlabsBlock, + [anthropicBlock.id]: anthropicBlock, + [togetherAiBlock.id]: togetherAiBlock, + [openRouterBlock.id]: openRouterBlock, +} as const diff --git a/packages/forge/repository/package.json b/packages/forge/repository/package.json index 5c5f01041..9e10c1c1f 100644 --- a/packages/forge/repository/package.json +++ b/packages/forge/repository/package.json @@ -2,8 +2,21 @@ "name": "@typebot.io/forge-repository", "version": "1.0.0", "description": "", - "main": "index.ts", "keywords": [], "author": "Baptiste Arnaud", - "license": "ISC" + "license": "ISC", + "devDependencies": { + "@typebot.io/forge": "workspace:*", + "@typebot.io/openai-block": "workspace:*", + "@typebot.io/zemantic-ai-block": "workspace:*", + "@typebot.io/cal-com-block": "workspace:*", + "@typebot.io/chat-node-block": "workspace:*", + "@typebot.io/qrcode-block": "workspace:*", + "@typebot.io/dify-ai-block": "workspace:*", + "@typebot.io/mistral-block": "workspace:*", + "@typebot.io/elevenlabs-block": "workspace:*", + "@typebot.io/anthropic-block": "workspace:*", + "@typebot.io/together-ai-block": "workspace:*", + "@typebot.io/open-router-block": "workspace:*" + } } diff --git a/packages/forge/repository/schemas.ts b/packages/forge/repository/schemas.ts new file mode 100644 index 000000000..d6e9e8f6a --- /dev/null +++ b/packages/forge/repository/schemas.ts @@ -0,0 +1,36 @@ +import { anthropicBlock } from '@typebot.io/anthropic-block' +import { anthropicBlockSchema } from '@typebot.io/anthropic-block/schemas' +import { calComBlock } from '@typebot.io/cal-com-block' +import { calComBlockSchema } from '@typebot.io/cal-com-block/schemas' +import { chatNodeBlock } from '@typebot.io/chat-node-block' +import { chatNodeBlockSchema } from '@typebot.io/chat-node-block/schemas' +import { difyAiBlock } from '@typebot.io/dify-ai-block' +import { difyAiBlockSchema } from '@typebot.io/dify-ai-block/schemas' +import { elevenlabsBlock } from '@typebot.io/elevenlabs-block' +import { elevenlabsBlockSchema } from '@typebot.io/elevenlabs-block/schemas' +import { mistralBlock } from '@typebot.io/mistral-block' +import { mistralBlockSchema } from '@typebot.io/mistral-block/schemas' +import { openRouterBlock } from '@typebot.io/open-router-block' +import { openRouterBlockSchema } from '@typebot.io/open-router-block/schemas' +import { openAIBlock } from '@typebot.io/openai-block' +import { openAIBlockSchema } from '@typebot.io/openai-block/schemas' +import { qrCodeBlock } from '@typebot.io/qrcode-block' +import { qrCodeBlockSchema } from '@typebot.io/qrcode-block/schemas' +import { togetherAiBlock } from '@typebot.io/together-ai-block' +import { togetherAiBlockSchema } from '@typebot.io/together-ai-block/schemas' +import { zemanticAiBlock } from '@typebot.io/zemantic-ai-block' +import { zemanticAiBlockSchema } from '@typebot.io/zemantic-ai-block/schemas' + +export const forgedBlockSchemas = { + [openAIBlock.id]: openAIBlockSchema, + [zemanticAiBlock.id]: zemanticAiBlockSchema, + [calComBlock.id]: calComBlockSchema, + [chatNodeBlock.id]: chatNodeBlockSchema, + [qrCodeBlock.id]: qrCodeBlockSchema, + [difyAiBlock.id]: difyAiBlockSchema, + [mistralBlock.id]: mistralBlockSchema, + [elevenlabsBlock.id]: elevenlabsBlockSchema, + [anthropicBlock.id]: anthropicBlockSchema, + [togetherAiBlock.id]: togetherAiBlockSchema, + [openRouterBlock.id]: openRouterBlockSchema, +} diff --git a/packages/forge/repository/types.ts b/packages/forge/repository/types.ts new file mode 100644 index 000000000..0649c709d --- /dev/null +++ b/packages/forge/repository/types.ts @@ -0,0 +1,10 @@ +import { z } from '@typebot.io/forge/zod' +import { forgedBlocks } from './definitions' +import { forgedBlockSchemas } from './schemas' + +export type ForgedBlock = z.infer< + (typeof forgedBlockSchemas)[keyof typeof forgedBlockSchemas] +> + +export type ForgedBlockDefinition = + (typeof forgedBlocks)[keyof typeof forgedBlocks] diff --git a/packages/forge/schemas/index.ts b/packages/forge/schemas/index.ts deleted file mode 100644 index b723f3603..000000000 --- a/packages/forge/schemas/index.ts +++ /dev/null @@ -1,42 +0,0 @@ -// Do not edit this file manually -import { anthropic } from '@typebot.io/anthropic-block' -import { openRouter } from '@typebot.io/open-router-block' -import { togetherAi } from '@typebot.io/together-ai-block' -import { elevenlabs } from '@typebot.io/elevenlabs-block' -import { difyAi } from '@typebot.io/dify-ai-block' -import { mistral } from '@typebot.io/mistral-block' -import { qrCode } from '@typebot.io/qrcode-block' -import { chatNode } from '@typebot.io/chat-node-block' -import { calCom } from '@typebot.io/cal-com-block' -import { zemanticAi } from '@typebot.io/zemantic-ai-block' -import { openAIBlock } from '@typebot.io/openai-block' -import { - BlockDefinition, - parseBlockCredentials, - parseBlockSchema, -} from '@typebot.io/forge' -import { enabledBlocks } from '@typebot.io/forge-repository' -import { z } from '@typebot.io/forge/zod' - -export const forgedBlocks = [ - openAIBlock, - zemanticAi, - calCom, - chatNode, - qrCode, - difyAi, - mistral, - elevenlabs, - anthropic, - togetherAi, - openRouter, -] as BlockDefinition<(typeof enabledBlocks)[number], any, any>[] - -export type ForgedBlockDefinition = (typeof forgedBlocks)[number] - -export const forgedBlockSchemas = forgedBlocks.map(parseBlockSchema) -export type ForgedBlock = z.infer<(typeof forgedBlockSchemas)[number]> - -export const forgedCredentialsSchemas = forgedBlocks - .filter((b) => b.auth) - .map(parseBlockCredentials) diff --git a/packages/forge/schemas/package.json b/packages/forge/schemas/package.json deleted file mode 100644 index 680612854..000000000 --- a/packages/forge/schemas/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "@typebot.io/forge-schemas", - "version": "1.0.0", - "description": "", - "main": "index.ts", - "keywords": [], - "author": "Baptiste Arnaud", - "license": "ISC", - "devDependencies": { - "@typebot.io/forge": "workspace:*", - "@typebot.io/forge-repository": "workspace:*", - "@typebot.io/openai-block": "workspace:*", - "@typebot.io/zemantic-ai-block": "workspace:*", - "@typebot.io/cal-com-block": "workspace:*", - "@typebot.io/chat-node-block": "workspace:*", - "@typebot.io/qrcode-block": "workspace:*", - "@typebot.io/dify-ai-block": "workspace:*", - "@typebot.io/mistral-block": "workspace:*", - "@typebot.io/elevenlabs-block": "workspace:*", - "@typebot.io/anthropic-block": "workspace:*", - "@typebot.io/together-ai-block": "workspace:*", - "@typebot.io/open-router-block": "workspace:*" - } -} diff --git a/packages/lib/package.json b/packages/lib/package.json index d77f2abde..4d293de9f 100644 --- a/packages/lib/package.json +++ b/packages/lib/package.json @@ -9,7 +9,6 @@ "@paralleldrive/cuid2": "2.2.1", "@playwright/test": "1.36.0", "@typebot.io/env": "workspace:*", - "@typebot.io/forge-repository": "workspace:*", "@typebot.io/prisma": "workspace:*", "@typebot.io/tsconfig": "workspace:*", "@types/escape-html": "^1.0.4", diff --git a/packages/schemas/features/blocks/forged/helpers.ts b/packages/schemas/features/blocks/forged/helpers.ts new file mode 100644 index 000000000..ba08979f5 --- /dev/null +++ b/packages/schemas/features/blocks/forged/helpers.ts @@ -0,0 +1,9 @@ +import { forgedBlocks } from '@typebot.io/forge-repository/definitions' +import { ForgedBlock } from '@typebot.io/forge-repository/types' +import { Block } from '../schema' + +export const isForgedBlock = (block: Block): block is ForgedBlock => + block.type in forgedBlocks +export const isForgedBlockType = ( + type: Block['type'] +): type is ForgedBlock['type'] => type in forgedBlocks diff --git a/packages/schemas/features/blocks/schema.ts b/packages/schemas/features/blocks/schema.ts index 2f5244208..5b609bf89 100644 --- a/packages/schemas/features/blocks/schema.ts +++ b/packages/schemas/features/blocks/schema.ts @@ -6,7 +6,7 @@ import { bubbleBlockSchemas } from './bubbles/schema' import { LogicBlock, logicBlockSchemas } from './logic/schema' import { InputBlock, inputBlockSchemas } from './inputs/schema' import { IntegrationBlock, integrationBlockSchemas } from './integrations' -import { enabledBlocks } from '@typebot.io/forge-repository' +import { forgedBlockSchemas } from '@typebot.io/forge-repository/schemas' export type BlockWithOptions = Extract @@ -34,15 +34,8 @@ export const blockSchemaV6 = z ...inputBlockSchemas.v6, ...logicBlockSchemas.v6, ...integrationBlockSchemas.v6, + ...Object.values(forgedBlockSchemas), ]) - .or( - blockBaseSchema.merge( - z.object({ - type: z.enum(enabledBlocks), - options: z.any().optional(), - }) - ) - ) .openapi({ title: 'Block', ref: 'block', diff --git a/packages/schemas/helpers.ts b/packages/schemas/helpers.ts index c80dd79a6..b1980456e 100644 --- a/packages/schemas/helpers.ts +++ b/packages/schemas/helpers.ts @@ -1,4 +1,4 @@ -import { enabledBlocks } from '@typebot.io/forge-repository' +import { forgedBlockIds } from '@typebot.io/forge-repository/constants' import { Block, InputBlock, @@ -62,9 +62,7 @@ export const isConditionBlock = (block: Block): block is ConditionBlock => export const isIntegrationBlock = (block: Block): block is IntegrationBlock => ( - Object.values(IntegrationBlockType).concat( - enabledBlocks as readonly any[] - ) as any[] + Object.values(IntegrationBlockType).concat(forgedBlockIds as any[]) as any[] ).includes(block.type) export const isWebhookBlock = (block: Block): block is HttpRequestBlock => diff --git a/packages/variables/deepParseVariables.ts b/packages/variables/deepParseVariables.ts index 1b1d9b9fa..1556d03de 100644 --- a/packages/variables/deepParseVariables.ts +++ b/packages/variables/deepParseVariables.ts @@ -1,10 +1,10 @@ -import { Variable } from '@typebot.io/schemas' import { defaultParseVariablesOptions, parseVariables, ParseVariablesOptions, } from './parseVariables' import { parseGuessedTypeFromString } from './parseGuessedTypeFromString' +import { Variable } from './types' type DeepParseOptions = { guessCorrectTypes?: boolean diff --git a/packages/variables/executeFunction.ts b/packages/variables/executeFunction.ts index 294621e6c..e4f738257 100644 --- a/packages/variables/executeFunction.ts +++ b/packages/variables/executeFunction.ts @@ -1,10 +1,11 @@ -import { Variable } from '@typebot.io/schemas' import { parseVariables } from './parseVariables' import { extractVariablesFromText } from './extractVariablesFromText' import { parseGuessedValueType } from './parseGuessedValueType' import { isDefined } from '@typebot.io/lib' -import { defaultTimeout } from '@typebot.io/schemas/features/blocks/integrations/webhook/constants' import { safeStringify } from '@typebot.io/lib/safeStringify' +import { Variable } from './types' + +const defaultTimeout = 10 type Props = { variables: Variable[] diff --git a/packages/variables/extractVariablesFromText.ts b/packages/variables/extractVariablesFromText.ts index c74d8876b..c9ec4560b 100644 --- a/packages/variables/extractVariablesFromText.ts +++ b/packages/variables/extractVariablesFromText.ts @@ -1,4 +1,4 @@ -import { Variable } from '@typebot.io/schemas' +import { Variable } from './types' export const extractVariablesFromText = (variables: Variable[]) => diff --git a/packages/variables/findUniqueVariableValue.ts b/packages/variables/findUniqueVariableValue.ts index 6f867c04e..426f0192c 100644 --- a/packages/variables/findUniqueVariableValue.ts +++ b/packages/variables/findUniqueVariableValue.ts @@ -1,4 +1,4 @@ -import { Variable } from '@typebot.io/schemas' +import { Variable } from './types' export const findUniqueVariableValue = (variables: Variable[]) => diff --git a/packages/variables/injectVariablesFromExistingResult.ts b/packages/variables/injectVariablesFromExistingResult.ts index bd6da8747..fbb1015fd 100644 --- a/packages/variables/injectVariablesFromExistingResult.ts +++ b/packages/variables/injectVariablesFromExistingResult.ts @@ -1,8 +1,8 @@ -import { Result, Variable } from '@typebot.io/schemas' +import { Variable } from './types' export const injectVariablesFromExistingResult = ( variables: Variable[], - resultVariables: Result['variables'] + resultVariables: any[] ): Variable[] => variables.map((variable) => { const resultVariable = resultVariables.find( diff --git a/packages/variables/package.json b/packages/variables/package.json index 751021bcc..91a5a0e92 100644 --- a/packages/variables/package.json +++ b/packages/variables/package.json @@ -4,7 +4,6 @@ "license": "AGPL-3.0-or-later", "private": true, "dependencies": { - "@typebot.io/lib": "workspace:*", - "@typebot.io/schemas": "workspace:*" + "@typebot.io/lib": "workspace:*" } } diff --git a/packages/variables/parseGuessedValueType.ts b/packages/variables/parseGuessedValueType.ts index 71f368913..11642eec4 100644 --- a/packages/variables/parseGuessedValueType.ts +++ b/packages/variables/parseGuessedValueType.ts @@ -1,4 +1,4 @@ -import { Variable } from '@typebot.io/schemas' +import { Variable } from './types' export const parseGuessedValueType = ( value: Variable['value'] diff --git a/packages/variables/parseVariableNumber.ts b/packages/variables/parseVariableNumber.ts index 906bbf466..1e599a436 100644 --- a/packages/variables/parseVariableNumber.ts +++ b/packages/variables/parseVariableNumber.ts @@ -1,6 +1,6 @@ -import { Variable } from '@typebot.io/schemas' import { parseGuessedValueType } from './parseGuessedValueType' import { parseVariables } from './parseVariables' +import { Variable } from './types' export const parseVariableNumber = (variables: Variable[]) => diff --git a/packages/variables/parseVariables.ts b/packages/variables/parseVariables.ts index ac0f1ab33..72fbfe42c 100644 --- a/packages/variables/parseVariables.ts +++ b/packages/variables/parseVariables.ts @@ -1,7 +1,7 @@ import { safeStringify } from '@typebot.io/lib/safeStringify' import { isDefined, isNotDefined } from '@typebot.io/lib/utils' -import { Variable, VariableWithValue } from '@typebot.io/schemas' import { parseGuessedValueType } from './parseGuessedValueType' +import { Variable, VariableWithValue } from './types' export type ParseVariablesOptions = { fieldToParse?: 'value' | 'id' diff --git a/packages/variables/prefillVariables.ts b/packages/variables/prefillVariables.ts index 3a3cd91fc..4b2111b61 100644 --- a/packages/variables/prefillVariables.ts +++ b/packages/variables/prefillVariables.ts @@ -1,9 +1,9 @@ import { safeStringify } from '@typebot.io/lib/safeStringify' -import { StartChatInput, Variable } from '@typebot.io/schemas' +import { Variable } from './types' export const prefillVariables = ( variables: Variable[], - prefilledVariables: NonNullable + prefilledVariables: Record ): Variable[] => variables.map((variable) => { const prefilledVariable = prefilledVariables[variable.name] diff --git a/packages/variables/transformVariablesToList.ts b/packages/variables/transformVariablesToList.ts index 3fe38a332..e7ee7ddac 100644 --- a/packages/variables/transformVariablesToList.ts +++ b/packages/variables/transformVariablesToList.ts @@ -1,5 +1,5 @@ import { isNotDefined } from '@typebot.io/lib/utils' -import { Variable, VariableWithValue } from '@typebot.io/schemas' +import { Variable, VariableWithValue } from './types' export const transformVariablesToList = (variables: Variable[]) => diff --git a/packages/variables/types.ts b/packages/variables/types.ts new file mode 100644 index 000000000..415bbd9a8 --- /dev/null +++ b/packages/variables/types.ts @@ -0,0 +1,13 @@ +export type Variable = { + id: string + name: string + value?: string | (string | null)[] | null | undefined +} + +export type VariableWithValue = Pick & { + value: string | (string | null)[] +} + +export type VariableWithUnknowValue = Pick & { + value?: unknown +} diff --git a/packages/variables/updateVariablesInSession.ts b/packages/variables/updateVariablesInSession.ts index 308c6e5f0..6ec79c0d7 100644 --- a/packages/variables/updateVariablesInSession.ts +++ b/packages/variables/updateVariablesInSession.ts @@ -1,26 +1,22 @@ import { safeStringify } from '@typebot.io/lib/safeStringify' -import { - SessionState, - VariableWithUnknowValue, - Variable, -} from '@typebot.io/schemas' +import { Variable, VariableWithUnknowValue } from './types' export const updateVariablesInSession = - (state: SessionState) => - (newVariables: VariableWithUnknowValue[]): SessionState => ({ + (state: any) => (newVariables: VariableWithUnknowValue[]) => ({ ...state, - typebotsQueue: state.typebotsQueue.map((typebotInQueue, index) => - index === 0 - ? { - ...typebotInQueue, - typebot: { - ...typebotInQueue.typebot, - variables: updateTypebotVariables(typebotInQueue.typebot)( - newVariables - ), - }, - } - : typebotInQueue + typebotsQueue: state.typebotsQueue.map( + (typebotInQueue: { typebot: { variables: Variable[] } }, index: number) => + index === 0 + ? { + ...typebotInQueue, + typebot: { + ...typebotInQueue.typebot, + variables: updateTypebotVariables(typebotInQueue.typebot)( + newVariables + ), + }, + } + : typebotInQueue ), }) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8e2a9d186..a788a8ea4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -285,9 +285,6 @@ importers: '@typebot.io/forge-repository': specifier: workspace:* version: link:../../packages/forge/repository - '@typebot.io/forge-schemas': - specifier: workspace:* - version: link:../../packages/forge/schemas '@typebot.io/lib': specifier: workspace:* version: link:../../packages/lib @@ -569,9 +566,6 @@ importers: '@typebot.io/forge-repository': specifier: workspace:* version: link:../../packages/forge/repository - '@typebot.io/forge-schemas': - specifier: workspace:* - version: link:../../packages/forge/schemas '@typebot.io/lib': specifier: workspace:* version: link:../../packages/lib @@ -742,9 +736,6 @@ importers: '@typebot.io/forge-repository': specifier: workspace:* version: link:../forge/repository - '@typebot.io/forge-schemas': - specifier: workspace:* - version: link:../forge/schemas '@types/nodemailer': specifier: 6.4.8 version: 6.4.8 @@ -963,9 +954,6 @@ importers: '@rollup/plugin-terser': specifier: 0.4.3 version: 0.4.3(rollup@3.26.2) - '@rollup/plugin-typescript': - specifier: 11.1.2 - version: 11.1.2(rollup@3.26.2)(tslib@2.6.0)(typescript@5.3.2) '@typebot.io/bot-engine': specifier: workspace:* version: link:../../bot-engine @@ -1045,9 +1033,6 @@ importers: '@rollup/plugin-terser': specifier: 0.4.3 version: 0.4.3(rollup@3.26.2) - '@rollup/plugin-typescript': - specifier: 11.1.2 - version: 11.1.2(rollup@3.26.2)(tslib@2.6.0)(typescript@5.3.2) '@typebot.io/js': specifier: workspace:* version: link:../js @@ -1118,9 +1103,6 @@ importers: '@rollup/plugin-terser': specifier: 0.4.3 version: 0.4.3(rollup@3.26.2) - '@rollup/plugin-typescript': - specifier: 11.1.2 - version: 11.1.2(rollup@3.26.2)(tslib@2.6.0)(typescript@5.3.2) '@typebot.io/js': specifier: workspace:* version: link:../js @@ -1488,9 +1470,6 @@ importers: specifier: 3.22.4 version: 3.22.4 devDependencies: - '@typebot.io/forge-repository': - specifier: workspace:* - version: link:../repository '@typebot.io/tsconfig': specifier: workspace:* version: link:../../tsconfig @@ -1498,9 +1477,7 @@ importers: specifier: 18.2.15 version: 18.2.15 - packages/forge/repository: {} - - packages/forge/schemas: + packages/forge/repository: devDependencies: '@typebot.io/anthropic-block': specifier: workspace:* @@ -1520,9 +1497,6 @@ importers: '@typebot.io/forge': specifier: workspace:* version: link:../core - '@typebot.io/forge-repository': - specifier: workspace:* - version: link:../repository '@typebot.io/mistral-block': specifier: workspace:* version: link:../blocks/mistral @@ -1620,9 +1594,6 @@ importers: '@typebot.io/env': specifier: workspace:* version: link:../env - '@typebot.io/forge-repository': - specifier: workspace:* - version: link:../forge/repository '@typebot.io/prisma': specifier: workspace:* version: link:../prisma @@ -1886,9 +1857,6 @@ importers: '@typebot.io/lib': specifier: workspace:* version: link:../lib - '@typebot.io/schemas': - specifier: workspace:* - version: link:../schemas packages: @@ -8722,26 +8690,6 @@ packages: terser: 5.29.1 dev: true - /@rollup/plugin-typescript@11.1.2(rollup@3.26.2)(tslib@2.6.0)(typescript@5.3.2): - resolution: {integrity: sha512-0ghSOCMcA7fl1JM+0gYRf+Q/HWyg+zg7/gDSc+fRLmlJWcW5K1I+CLRzaRhXf4Y3DRyPnnDo4M2ktw+a6JcDEg==} - engines: {node: '>=14.0.0'} - peerDependencies: - rollup: ^2.14.0||^3.0.0 - tslib: '*' - typescript: '>=3.7.0' - peerDependenciesMeta: - rollup: - optional: true - tslib: - optional: true - dependencies: - '@rollup/pluginutils': 5.1.0(rollup@3.26.2) - resolve: 1.22.8 - rollup: 3.26.2 - tslib: 2.6.0 - typescript: 5.3.2 - dev: true - /@rollup/pluginutils@5.1.0(rollup@2.78.0): resolution: {integrity: sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==} engines: {node: '>=14.0.0'}