📦 Update cuid to cuid2

This commit is contained in:
Baptiste Arnaud
2023-02-10 15:06:02 +01:00
parent 2dbf0fb848
commit 51f76700b2
77 changed files with 254 additions and 250 deletions

View File

@@ -1,4 +1,4 @@
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import {
defaultSettings,
defaultTheme,
@@ -33,8 +33,8 @@ export const parseNewTypebot = ({
ownerAvatarUrl?: string
isBrandingEnabled?: boolean
}): NewTypebotProps => {
const startGroupId = cuid()
const startBlockId = cuid()
const startGroupId = createId()
const startBlockId = createId()
const startBlock: StartBlock = {
groupId: startGroupId,
id: startBlockId,

View File

@@ -1,7 +1,7 @@
import { createFolders } from '@/test/utils/databaseActions'
import { deleteButtonInConfirmDialog } from '@/test/utils/selectorUtils'
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { createTypebots } from 'utils/playwright/databaseActions'
test('folders navigation should work', async ({ page }) => {
@@ -47,7 +47,7 @@ test('folders and typebots should be deletable', async ({ page }) => {
})
test('folders and typebots should be movable', async ({ page }) => {
const droppableFolderId = cuid()
const droppableFolderId = createId()
await createFolders([{ id: droppableFolderId, name: 'Droppable folder' }])
await createTypebots([{ name: 'Draggable typebot' }])
await page.goto('/typebots')

View File

@@ -1,5 +1,5 @@
import { duplicateWebhookQueries } from '@/features/blocks/integrations/webhook'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { Plan, Prisma } from 'db'
import {
ChoiceInputBlock,
@@ -50,7 +50,7 @@ const duplicateTypebot = (
.filter(isWebhookBlock)
.map((s) => ({ id: s.webhookId }))
)
const id = cuid()
const id = createId()
return {
typebot: {
...typebot,
@@ -131,6 +131,6 @@ const duplicateTypebot = (
const generateOldNewIdsMapping = (itemWithId: { id: string }[]) => {
const idsMapping: Map<string, string> = new Map()
itemWithId.forEach((item) => idsMapping.set(item.id, cuid()))
itemWithId.forEach((item) => idsMapping.set(item.id, createId()))
return idsMapping
}