import { Firecrawl } from "firecrawl" import * as z from "zod" const FIRECRAWL_SECRET_SCHEMA = z.object({ apiKey: z.string().min(1), }) /** * Creates the official authenticated Firecrawl v2 client. * * Use this escape hatch for Firecrawl endpoints that do not yet have a packaged * action. * * @param secret - Resolved Firecrawl integration secret. */ export function getFirecrawlApi(secret: Record) { const { apiKey } = FIRECRAWL_SECRET_SCHEMA.parse(secret) return new Firecrawl({ apiKey }) }