Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

Nick: exec js actions

Nicolas7500ebe4c6dd
diff --git a/apps/api/src/controllers/v1/types.ts b/apps/api/src/controllers/v1/types.ts
index 9585175e8..b5c27577a 100644
--- a/apps/api/src/controllers/v1/types.ts
+++ b/apps/api/src/controllers/v1/types.ts
@@ -92,6 +92,10 @@ export const actionsSchema = z.array(z.union([
z.object({
type: z.literal("scrape"),
}),
+ z.object({
+ type: z.literal("executeJavascript"),
+ script: z.string()
+ }),
]));
export const scrapeOptions = z.object({
diff --git a/apps/api/src/lib/entities.ts b/apps/api/src/lib/entities.ts
index 2c8f376de..c382c1863 100644
--- a/apps/api/src/lib/entities.ts
+++ b/apps/api/src/lib/entities.ts
@@ -31,6 +31,9 @@ export type Action = {
direction: "up" | "down"
} | {
type: "scrape",
+} | {
+ type: "executeJavascript",
+ script: string,
}
export type PageOptions = {
diff --git a/apps/js-sdk/firecrawl/src/index.ts b/apps/js-sdk/firecrawl/src/index.ts
index 7ad5a5f0f..bcf9d5b73 100644
--- a/apps/js-sdk/firecrawl/src/index.ts
+++ b/apps/js-sdk/firecrawl/src/index.ts
@@ -109,6 +109,9 @@ export type Action = {
direction: "up" | "down",
} | {
type: "scrape",
+} | {
+ type: "executeJavascript",
+ script: string,
};
export interface ScrapeParams<LLMSchema extends zt.ZodSchema = any, ActionsSchema extends (Action[] | undefined) = undefined> extends CrawlScrapeOptions {