2
0

🐛 (credentials) Fix credentials not listing when workspace has legacy zemantic

This commit is contained in:
Baptiste Arnaud
2024-07-16 16:36:14 +02:00
parent 867041e7d8
commit bd6921b90c
6 changed files with 24 additions and 5 deletions

View File

@ -1,4 +1,5 @@
import { z } from '../zod'
import { zemanticAiCredentialsSchema } from './blocks'
import { stripeCredentialsSchema } from './blocks/inputs/payment/schema'
import { googleSheetsCredentialsSchema } from './blocks/integrations/googleSheets/schema'
import { smtpCredentialsSchema } from './blocks/integrations/sendEmail'
@ -10,19 +11,30 @@ const credentialsSchema = z.discriminatedUnion('type', [
googleSheetsCredentialsSchema,
stripeCredentialsSchema,
whatsAppCredentialsSchema,
zemanticAiCredentialsSchema,
...Object.values(forgedCredentialsSchemas),
])
export type Credentials = z.infer<typeof credentialsSchema>
export type CredentialsWithoutLegacy = Exclude<
Credentials,
{
type: 'zemanticAi'
}
>
export const credentialsTypes = [
'smtp',
'google sheets',
'stripe',
'whatsApp',
'zemanticAi',
...(Object.keys(forgedCredentialsSchemas) as Array<
keyof typeof forgedCredentialsSchemas
>),
] as const
export const credentialsTypeSchema = z.enum(credentialsTypes)
export const legacyCredentialsTypes = ['zemanticAi']