UNPKG

@mintlify/validation

Version:

Validates mint.json files

70 lines (69 loc) 2.58 kB
import { z } from 'zod'; const amplitudeConfigInterfaceSchema = z.object({ apiKey: z.string(), }); const clearbitConfigInterfaceSchema = z.object({ publicApiKey: z.string(), }); const fathomConfigInterfaceSchema = z.object({ siteId: z.string(), }); const googleAnalyticsConfigInterfaceSchema = z.object({ measurementId: z.string().startsWith('G', 'Must start with G'), }); const googleTagManagerConfigInterfaceSchema = z.object({ tagId: z.string().startsWith('G', 'Must start with G'), }); const hotjarConfigInterfaceSchema = z.object({ hjid: z.string(), hjsv: z.string(), }); const koalaConfigInterfaceSchema = z.object({ publicApiKey: z.string().min(2), }); const logrocketConfigInterfaceSchema = z.object({ appId: z.string(), }); const mixpanelConfigInterfaceSchema = z.object({ projectToken: z.string(), }); const pirschConfigInterfaceSchema = z.object({ id: z.string(), }); const postHogConfigInterfaceSchema = z.object({ apiKey: z.string().startsWith('phc_', 'Must start with phc_'), apiHost: z.string().url('Must be a valid URL').optional(), }); const plausibleConfigInterfaceSchema = z.object({ domain: z .string() .refine((domain) => !domain.startsWith('https://'), 'Must not start with https://'), server: z .string() .refine((server) => !server.startsWith('https://'), 'Must not start with https://') .optional(), }); const heapConfigInterfaceSchema = z.object({ appId: z.string(), }); const segmentConfigInterfaceSchema = z.object({ key: z.string(), }); export const analyticsSchema = z .object({ amplitude: amplitudeConfigInterfaceSchema.optional(), clearbit: clearbitConfigInterfaceSchema.optional(), fathom: fathomConfigInterfaceSchema.optional(), ga4: googleAnalyticsConfigInterfaceSchema.optional(), gtm: googleTagManagerConfigInterfaceSchema.optional(), heap: heapConfigInterfaceSchema.optional(), hotjar: hotjarConfigInterfaceSchema.optional(), koala: koalaConfigInterfaceSchema.optional(), logrocket: logrocketConfigInterfaceSchema.optional(), mixpanel: mixpanelConfigInterfaceSchema.optional(), pirsch: pirschConfigInterfaceSchema.optional(), posthog: postHogConfigInterfaceSchema.optional(), plausible: plausibleConfigInterfaceSchema.optional(), segment: segmentConfigInterfaceSchema.optional(), }) .strict('Mintlify only supports analytics integrations from: amplitude, clearbit, fathom, ga4, gtm, heap, hotjar, koala, logrocket, mixpanel, pirsch, posthog, plausible, and segment.');