♻️ Remove @typebot.io/schemas from @typebot.io/lib

This commit is contained in:
Baptiste Arnaud
2024-03-15 16:32:29 +01:00
parent b53242ce6a
commit 5073be2439
186 changed files with 809 additions and 581 deletions

View File

@@ -4,7 +4,7 @@ import { SessionState } from '@typebot.io/schemas'
import { StreamingTextResponse } from 'ai'
import OpenAI from 'openai'
import { NextResponse } from 'next/dist/server/web/spec-extension/response'
import { getBlockById } from '@typebot.io/lib/getBlockById'
import { getBlockById } from '@typebot.io/schemas/helpers'
import { forgedBlocks } from '@typebot.io/forge-schemas'
import { decryptV2 } from '@typebot.io/lib/api/encryption/decryptV2'
import { ReadOnlyVariableStore } from '@typebot.io/forge'

View File

@@ -7,7 +7,7 @@ import prisma from '@typebot.io/lib/prisma'
import { getSession } from '@typebot.io/bot-engine/queries/getSession'
import { parseGroups } from '@typebot.io/schemas'
import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants'
import { getBlockById } from '@typebot.io/lib/getBlockById'
import { getBlockById } from '@typebot.io/schemas/helpers'
export const generateUploadUrl = publicProcedure
.meta({

View File

@@ -9,14 +9,9 @@ import {
} from '@typebot.io/schemas'
import { NextApiRequest, NextApiResponse } from 'next'
import got, { Method, Headers, HTTPError } from 'got'
import {
byId,
isEmpty,
isNotDefined,
isWebhookBlock,
omit,
} from '@typebot.io/lib'
import { parseAnswers } from '@typebot.io/lib/results/parseAnswers'
import { byId, isEmpty, isNotDefined, omit } from '@typebot.io/lib'
import { isWebhookBlock } from '@typebot.io/schemas/helpers'
import { parseAnswers } from '@typebot.io/results/parseAnswers'
import { initMiddleware, methodNotAllowed, notFound } from '@typebot.io/lib/api'
import { stringify } from 'qs'
import Cors from 'cors'
@@ -33,7 +28,7 @@ import {
defaultWebhookAttributes,
maxTimeout,
} from '@typebot.io/schemas/features/blocks/integrations/webhook/constants'
import { getBlockById } from '@typebot.io/lib/getBlockById'
import { getBlockById } from '@typebot.io/schemas/helpers'
import {
convertKeyValueTableToObject,
longReqTimeoutWhitelist,

View File

@@ -7,7 +7,7 @@ import {
import { NextApiRequest, NextApiResponse } from 'next'
import { createTransport, getTestMessageUrl } from 'nodemailer'
import { isDefined, isEmpty, isNotDefined, omit } from '@typebot.io/lib'
import { parseAnswers } from '@typebot.io/lib/results/parseAnswers'
import { parseAnswers } from '@typebot.io/results/parseAnswers'
import { methodNotAllowed, initMiddleware } from '@typebot.io/lib/api'
import { decrypt } from '@typebot.io/lib/api/encryption/decrypt'

View File

@@ -2,7 +2,7 @@ import { authenticateUser } from '@/helpers/authenticateUser'
import prisma from '@typebot.io/lib/prisma'
import { Group, HttpRequestBlock } from '@typebot.io/schemas'
import { NextApiRequest, NextApiResponse } from 'next'
import { isWebhookBlock } from '@typebot.io/lib'
import { isWebhookBlock } from '@typebot.io/schemas/helpers'
import { methodNotAllowed } from '@typebot.io/lib/api'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {

View File

@@ -2,7 +2,8 @@ import { authenticateUser } from '@/helpers/authenticateUser'
import prisma from '@typebot.io/lib/prisma'
import { Group } from '@typebot.io/schemas'
import { NextApiRequest, NextApiResponse } from 'next'
import { isNotDefined, isWebhookBlock } from '@typebot.io/lib'
import { isNotDefined } from '@typebot.io/lib'
import { isWebhookBlock } from '@typebot.io/schemas/helpers'
import { methodNotAllowed } from '@typebot.io/lib/api'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {

View File

@@ -7,7 +7,7 @@ import {
deleteTypebots,
deleteWebhooks,
importTypebotInDatabase,
} from '@typebot.io/lib/playwright/databaseActions'
} from '@typebot.io/playwright/databaseActions'
import { HttpMethod } from '@typebot.io/schemas/features/blocks/integrations/webhook/constants'
import { StartChatInput, StartPreviewChatInput } from '@typebot.io/schemas'

View File

@@ -1,7 +1,7 @@
import test, { expect } from '@playwright/test'
import { createId } from '@paralleldrive/cuid2'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers'
import { createTypebots } from '@typebot.io/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/playwright/databaseHelpers'
import { IntegrationBlockType } from '@typebot.io/schemas/features/blocks/integrations/constants'
const typebotId = createId()

View File

@@ -3,7 +3,7 @@ import { createId } from '@paralleldrive/cuid2'
import { parse } from 'papaparse'
import { readFileSync } from 'fs'
import { isDefined } from '@typebot.io/lib'
import { importTypebotInDatabase } from '@typebot.io/lib/playwright/databaseActions'
import { importTypebotInDatabase } from '@typebot.io/playwright/databaseActions'
import { getTestAsset } from '@/test/utils/playwright'
import { env } from '@typebot.io/env'

View File

@@ -0,0 +1,6 @@
import { test as setup } from '@playwright/test'
import { globalSetup } from '@typebot.io/playwright/globalSetup'
setup('setup db', async () => {
await globalSetup()
})

View File

@@ -1,7 +1,7 @@
import { getTestAsset } from '@/test/utils/playwright'
import test, { expect } from '@playwright/test'
import { createId } from '@paralleldrive/cuid2'
import { importTypebotInDatabase } from '@typebot.io/lib/playwright/databaseActions'
import { importTypebotInDatabase } from '@typebot.io/playwright/databaseActions'
import { env } from '@typebot.io/env'
test('Big groups should work as expected', async ({ page }) => {

View File

@@ -1,6 +1,6 @@
import test, { expect } from '@playwright/test'
import { createId } from '@paralleldrive/cuid2'
import { importTypebotInDatabase } from '@typebot.io/lib/playwright/databaseActions'
import { importTypebotInDatabase } from '@typebot.io/playwright/databaseActions'
import { SmtpCredentials } from '@typebot.io/schemas'
import { env } from '@typebot.io/env'
import { createSmtpCredentials } from './utils/databaseActions'

View File

@@ -3,8 +3,8 @@ import { createId } from '@paralleldrive/cuid2'
import {
createTypebots,
updateTypebot,
} from '@typebot.io/lib/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers'
} from '@typebot.io/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/playwright/databaseHelpers'
import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants'
import { Settings } from '@typebot.io/schemas'
import { defaultTextInputOptions } from '@typebot.io/schemas/features/blocks/inputs/text/constants'

View File

@@ -1,7 +1,7 @@
import { getTestAsset } from '@/test/utils/playwright'
import test, { expect } from '@playwright/test'
import { env } from '@typebot.io/env'
import { importTypebotInDatabase } from '@typebot.io/lib/playwright/databaseActions'
import { importTypebotInDatabase } from '@typebot.io/playwright/databaseActions'
const typebotId = 'cl0ibhi7s0018n21aarlmg0cm'
const typebotWithMergeDisabledId = 'cl0ibhi7s0018n21aarlag0cm'

View File

@@ -1,7 +1,7 @@
import { PrismaClient } from '@typebot.io/prisma'
import { SmtpCredentials } from '@typebot.io/schemas'
import { encrypt } from '@typebot.io/lib/api/encryption/encrypt'
import { proWorkspaceId } from '@typebot.io/lib/playwright/databaseSetup'
import { proWorkspaceId } from '@typebot.io/playwright/databaseSetup'
const prisma = new PrismaClient()

View File

@@ -1,7 +1,7 @@
import { getTestAsset } from '@/test/utils/playwright'
import test, { expect } from '@playwright/test'
import { createId } from '@paralleldrive/cuid2'
import { importTypebotInDatabase } from '@typebot.io/lib/playwright/databaseActions'
import { importTypebotInDatabase } from '@typebot.io/playwright/databaseActions'
test('should correctly be injected', async ({ page }) => {
const typebotId = createId()

View File

@@ -3,7 +3,7 @@ import { createId } from '@paralleldrive/cuid2'
import {
createWebhook,
importTypebotInDatabase,
} from '@typebot.io/lib/playwright/databaseActions'
} from '@typebot.io/playwright/databaseActions'
import { getTestAsset } from '@/test/utils/playwright'
import { HttpMethod } from '@typebot.io/schemas/features/blocks/integrations/webhook/constants'