@mendable/firecrawl-js 4.13.0-beta.1 → 4.13.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-XXDTBMNV.js → chunk-WBUKU64H.js} +1 -1
- package/dist/index.cjs +9 -8
- package/dist/index.d.cts +17 -7
- package/dist/index.d.ts +17 -7
- package/dist/index.js +10 -9
- package/dist/{package-WXWM2ZOD.js → package-Q6GJF2UB.js} +1 -1
- package/package.json +1 -1
- package/src/v2/client.ts +4 -4
- package/src/v2/methods/browser.ts +8 -6
- package/src/v2/types.ts +9 -0
|
@@ -8,7 +8,7 @@ var require_package = __commonJS({
|
|
|
8
8
|
"package.json"(exports, module) {
|
|
9
9
|
module.exports = {
|
|
10
10
|
name: "@mendable/firecrawl-js",
|
|
11
|
-
version: "4.13.0-beta.
|
|
11
|
+
version: "4.13.0-beta.3",
|
|
12
12
|
description: "JavaScript SDK for Firecrawl API",
|
|
13
13
|
main: "dist/index.js",
|
|
14
14
|
types: "dist/index.d.ts",
|
package/dist/index.cjs
CHANGED
|
@@ -35,7 +35,7 @@ var require_package = __commonJS({
|
|
|
35
35
|
"package.json"(exports2, module2) {
|
|
36
36
|
module2.exports = {
|
|
37
37
|
name: "@mendable/firecrawl-js",
|
|
38
|
-
version: "4.13.0-beta.
|
|
38
|
+
version: "4.13.0-beta.3",
|
|
39
39
|
description: "JavaScript SDK for Firecrawl API",
|
|
40
40
|
main: "dist/index.js",
|
|
41
41
|
types: "dist/index.d.ts",
|
|
@@ -931,8 +931,8 @@ async function cancelAgent(http, jobId) {
|
|
|
931
931
|
// src/v2/methods/browser.ts
|
|
932
932
|
async function browser(http, args = {}) {
|
|
933
933
|
const body = {};
|
|
934
|
-
if (args.
|
|
935
|
-
if (args.
|
|
934
|
+
if (args.ttl != null) body.ttl = args.ttl;
|
|
935
|
+
if (args.activityTtl != null) body.activityTtl = args.activityTtl;
|
|
936
936
|
if (args.streamWebView != null) body.streamWebView = args.streamWebView;
|
|
937
937
|
try {
|
|
938
938
|
const res = await http.post("/v2/browser", body);
|
|
@@ -946,8 +946,9 @@ async function browser(http, args = {}) {
|
|
|
946
946
|
async function browserExecute(http, sessionId, args) {
|
|
947
947
|
const body = {
|
|
948
948
|
code: args.code,
|
|
949
|
-
language: args.language ?? "
|
|
949
|
+
language: args.language ?? "bash"
|
|
950
950
|
};
|
|
951
|
+
if (args.timeout != null) body.timeout = args.timeout;
|
|
951
952
|
try {
|
|
952
953
|
const res = await http.post(
|
|
953
954
|
`/v2/browser/${sessionId}/execute`,
|
|
@@ -1481,8 +1482,8 @@ var FirecrawlClient = class {
|
|
|
1481
1482
|
// Browser
|
|
1482
1483
|
/**
|
|
1483
1484
|
* Create a new browser session.
|
|
1484
|
-
* @param args Session options (
|
|
1485
|
-
* @returns Session id and
|
|
1485
|
+
* @param args Session options (ttl, activityTtl, streamWebView).
|
|
1486
|
+
* @returns Session id, CDP URL, live view URL, and expiration time.
|
|
1486
1487
|
*/
|
|
1487
1488
|
async browser(args = {}) {
|
|
1488
1489
|
return browser(this.http, args);
|
|
@@ -1490,8 +1491,8 @@ var FirecrawlClient = class {
|
|
|
1490
1491
|
/**
|
|
1491
1492
|
* Execute code in a browser session.
|
|
1492
1493
|
* @param sessionId Browser session id.
|
|
1493
|
-
* @param args Code and
|
|
1494
|
-
* @returns Execution result.
|
|
1494
|
+
* @param args Code, language ("python" | "node" | "bash"), and optional timeout.
|
|
1495
|
+
* @returns Execution result including stdout, stderr, exitCode, and killed status.
|
|
1495
1496
|
*/
|
|
1496
1497
|
async browserExecute(sessionId, args) {
|
|
1497
1498
|
return browserExecute(this.http, sessionId, args);
|
package/dist/index.d.cts
CHANGED
|
@@ -558,21 +558,30 @@ interface BrowserCreateResponse {
|
|
|
558
558
|
success: boolean;
|
|
559
559
|
id?: string;
|
|
560
560
|
cdpUrl?: string;
|
|
561
|
+
liveViewUrl?: string;
|
|
562
|
+
expiresAt?: string;
|
|
561
563
|
error?: string;
|
|
562
564
|
}
|
|
563
565
|
interface BrowserExecuteResponse {
|
|
564
566
|
success: boolean;
|
|
567
|
+
stdout?: string;
|
|
565
568
|
result?: string;
|
|
569
|
+
stderr?: string;
|
|
570
|
+
exitCode?: number;
|
|
571
|
+
killed?: boolean;
|
|
566
572
|
error?: string;
|
|
567
573
|
}
|
|
568
574
|
interface BrowserDeleteResponse {
|
|
569
575
|
success: boolean;
|
|
576
|
+
sessionDurationMs?: number;
|
|
577
|
+
creditsBilled?: number;
|
|
570
578
|
error?: string;
|
|
571
579
|
}
|
|
572
580
|
interface BrowserSession {
|
|
573
581
|
id: string;
|
|
574
582
|
status: string;
|
|
575
583
|
cdpUrl: string;
|
|
584
|
+
liveViewUrl: string;
|
|
576
585
|
streamWebView: boolean;
|
|
577
586
|
createdAt: string;
|
|
578
587
|
lastActivity: string;
|
|
@@ -635,13 +644,14 @@ declare function prepareAgentPayload(args: {
|
|
|
635
644
|
declare function startAgent(http: HttpClient, args: Parameters<typeof prepareAgentPayload>[0]): Promise<AgentResponse>;
|
|
636
645
|
|
|
637
646
|
declare function browser(http: HttpClient, args?: {
|
|
638
|
-
|
|
639
|
-
|
|
647
|
+
ttl?: number;
|
|
648
|
+
activityTtl?: number;
|
|
640
649
|
streamWebView?: boolean;
|
|
641
650
|
}): Promise<BrowserCreateResponse>;
|
|
642
651
|
declare function browserExecute(http: HttpClient, sessionId: string, args: {
|
|
643
652
|
code: string;
|
|
644
|
-
language?: "python" | "
|
|
653
|
+
language?: "python" | "node" | "bash";
|
|
654
|
+
timeout?: number;
|
|
645
655
|
}): Promise<BrowserExecuteResponse>;
|
|
646
656
|
declare function listBrowsers(http: HttpClient, args?: {
|
|
647
657
|
status?: "active" | "destroyed";
|
|
@@ -854,15 +864,15 @@ declare class FirecrawlClient {
|
|
|
854
864
|
cancelAgent(jobId: string): Promise<boolean>;
|
|
855
865
|
/**
|
|
856
866
|
* Create a new browser session.
|
|
857
|
-
* @param args Session options (
|
|
858
|
-
* @returns Session id and
|
|
867
|
+
* @param args Session options (ttl, activityTtl, streamWebView).
|
|
868
|
+
* @returns Session id, CDP URL, live view URL, and expiration time.
|
|
859
869
|
*/
|
|
860
870
|
browser(args?: Parameters<typeof browser>[1]): Promise<BrowserCreateResponse>;
|
|
861
871
|
/**
|
|
862
872
|
* Execute code in a browser session.
|
|
863
873
|
* @param sessionId Browser session id.
|
|
864
|
-
* @param args Code and
|
|
865
|
-
* @returns Execution result.
|
|
874
|
+
* @param args Code, language ("python" | "node" | "bash"), and optional timeout.
|
|
875
|
+
* @returns Execution result including stdout, stderr, exitCode, and killed status.
|
|
866
876
|
*/
|
|
867
877
|
browserExecute(sessionId: string, args: Parameters<typeof browserExecute>[2]): Promise<BrowserExecuteResponse>;
|
|
868
878
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -558,21 +558,30 @@ interface BrowserCreateResponse {
|
|
|
558
558
|
success: boolean;
|
|
559
559
|
id?: string;
|
|
560
560
|
cdpUrl?: string;
|
|
561
|
+
liveViewUrl?: string;
|
|
562
|
+
expiresAt?: string;
|
|
561
563
|
error?: string;
|
|
562
564
|
}
|
|
563
565
|
interface BrowserExecuteResponse {
|
|
564
566
|
success: boolean;
|
|
567
|
+
stdout?: string;
|
|
565
568
|
result?: string;
|
|
569
|
+
stderr?: string;
|
|
570
|
+
exitCode?: number;
|
|
571
|
+
killed?: boolean;
|
|
566
572
|
error?: string;
|
|
567
573
|
}
|
|
568
574
|
interface BrowserDeleteResponse {
|
|
569
575
|
success: boolean;
|
|
576
|
+
sessionDurationMs?: number;
|
|
577
|
+
creditsBilled?: number;
|
|
570
578
|
error?: string;
|
|
571
579
|
}
|
|
572
580
|
interface BrowserSession {
|
|
573
581
|
id: string;
|
|
574
582
|
status: string;
|
|
575
583
|
cdpUrl: string;
|
|
584
|
+
liveViewUrl: string;
|
|
576
585
|
streamWebView: boolean;
|
|
577
586
|
createdAt: string;
|
|
578
587
|
lastActivity: string;
|
|
@@ -635,13 +644,14 @@ declare function prepareAgentPayload(args: {
|
|
|
635
644
|
declare function startAgent(http: HttpClient, args: Parameters<typeof prepareAgentPayload>[0]): Promise<AgentResponse>;
|
|
636
645
|
|
|
637
646
|
declare function browser(http: HttpClient, args?: {
|
|
638
|
-
|
|
639
|
-
|
|
647
|
+
ttl?: number;
|
|
648
|
+
activityTtl?: number;
|
|
640
649
|
streamWebView?: boolean;
|
|
641
650
|
}): Promise<BrowserCreateResponse>;
|
|
642
651
|
declare function browserExecute(http: HttpClient, sessionId: string, args: {
|
|
643
652
|
code: string;
|
|
644
|
-
language?: "python" | "
|
|
653
|
+
language?: "python" | "node" | "bash";
|
|
654
|
+
timeout?: number;
|
|
645
655
|
}): Promise<BrowserExecuteResponse>;
|
|
646
656
|
declare function listBrowsers(http: HttpClient, args?: {
|
|
647
657
|
status?: "active" | "destroyed";
|
|
@@ -854,15 +864,15 @@ declare class FirecrawlClient {
|
|
|
854
864
|
cancelAgent(jobId: string): Promise<boolean>;
|
|
855
865
|
/**
|
|
856
866
|
* Create a new browser session.
|
|
857
|
-
* @param args Session options (
|
|
858
|
-
* @returns Session id and
|
|
867
|
+
* @param args Session options (ttl, activityTtl, streamWebView).
|
|
868
|
+
* @returns Session id, CDP URL, live view URL, and expiration time.
|
|
859
869
|
*/
|
|
860
870
|
browser(args?: Parameters<typeof browser>[1]): Promise<BrowserCreateResponse>;
|
|
861
871
|
/**
|
|
862
872
|
* Execute code in a browser session.
|
|
863
873
|
* @param sessionId Browser session id.
|
|
864
|
-
* @param args Code and
|
|
865
|
-
* @returns Execution result.
|
|
874
|
+
* @param args Code, language ("python" | "node" | "bash"), and optional timeout.
|
|
875
|
+
* @returns Execution result including stdout, stderr, exitCode, and killed status.
|
|
866
876
|
*/
|
|
867
877
|
browserExecute(sessionId: string, args: Parameters<typeof browserExecute>[2]): Promise<BrowserExecuteResponse>;
|
|
868
878
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
require_package
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WBUKU64H.js";
|
|
4
4
|
|
|
5
5
|
// src/v2/utils/httpClient.ts
|
|
6
6
|
import axios from "axios";
|
|
@@ -815,8 +815,8 @@ async function cancelAgent(http, jobId) {
|
|
|
815
815
|
// src/v2/methods/browser.ts
|
|
816
816
|
async function browser(http, args = {}) {
|
|
817
817
|
const body = {};
|
|
818
|
-
if (args.
|
|
819
|
-
if (args.
|
|
818
|
+
if (args.ttl != null) body.ttl = args.ttl;
|
|
819
|
+
if (args.activityTtl != null) body.activityTtl = args.activityTtl;
|
|
820
820
|
if (args.streamWebView != null) body.streamWebView = args.streamWebView;
|
|
821
821
|
try {
|
|
822
822
|
const res = await http.post("/v2/browser", body);
|
|
@@ -830,8 +830,9 @@ async function browser(http, args = {}) {
|
|
|
830
830
|
async function browserExecute(http, sessionId, args) {
|
|
831
831
|
const body = {
|
|
832
832
|
code: args.code,
|
|
833
|
-
language: args.language ?? "
|
|
833
|
+
language: args.language ?? "bash"
|
|
834
834
|
};
|
|
835
|
+
if (args.timeout != null) body.timeout = args.timeout;
|
|
835
836
|
try {
|
|
836
837
|
const res = await http.post(
|
|
837
838
|
`/v2/browser/${sessionId}/execute`,
|
|
@@ -1365,8 +1366,8 @@ var FirecrawlClient = class {
|
|
|
1365
1366
|
// Browser
|
|
1366
1367
|
/**
|
|
1367
1368
|
* Create a new browser session.
|
|
1368
|
-
* @param args Session options (
|
|
1369
|
-
* @returns Session id and
|
|
1369
|
+
* @param args Session options (ttl, activityTtl, streamWebView).
|
|
1370
|
+
* @returns Session id, CDP URL, live view URL, and expiration time.
|
|
1370
1371
|
*/
|
|
1371
1372
|
async browser(args = {}) {
|
|
1372
1373
|
return browser(this.http, args);
|
|
@@ -1374,8 +1375,8 @@ var FirecrawlClient = class {
|
|
|
1374
1375
|
/**
|
|
1375
1376
|
* Execute code in a browser session.
|
|
1376
1377
|
* @param sessionId Browser session id.
|
|
1377
|
-
* @param args Code and
|
|
1378
|
-
* @returns Execution result.
|
|
1378
|
+
* @param args Code, language ("python" | "node" | "bash"), and optional timeout.
|
|
1379
|
+
* @returns Execution result including stdout, stderr, exitCode, and killed status.
|
|
1379
1380
|
*/
|
|
1380
1381
|
async browserExecute(sessionId, args) {
|
|
1381
1382
|
return browserExecute(this.http, sessionId, args);
|
|
@@ -1464,7 +1465,7 @@ var FirecrawlApp = class {
|
|
|
1464
1465
|
if (typeof process !== "undefined" && process.env && process.env.npm_package_version) {
|
|
1465
1466
|
return process.env.npm_package_version;
|
|
1466
1467
|
}
|
|
1467
|
-
const packageJson = await import("./package-
|
|
1468
|
+
const packageJson = await import("./package-Q6GJF2UB.js");
|
|
1468
1469
|
return packageJson.default.version;
|
|
1469
1470
|
} catch (error) {
|
|
1470
1471
|
const isTest = typeof process !== "undefined" && (process.env.JEST_WORKER_ID != null || false);
|
package/package.json
CHANGED
package/src/v2/client.ts
CHANGED
|
@@ -311,8 +311,8 @@ export class FirecrawlClient {
|
|
|
311
311
|
// Browser
|
|
312
312
|
/**
|
|
313
313
|
* Create a new browser session.
|
|
314
|
-
* @param args Session options (
|
|
315
|
-
* @returns Session id and
|
|
314
|
+
* @param args Session options (ttl, activityTtl, streamWebView).
|
|
315
|
+
* @returns Session id, CDP URL, live view URL, and expiration time.
|
|
316
316
|
*/
|
|
317
317
|
async browser(
|
|
318
318
|
args: Parameters<typeof browserMethod>[1] = {}
|
|
@@ -322,8 +322,8 @@ export class FirecrawlClient {
|
|
|
322
322
|
/**
|
|
323
323
|
* Execute code in a browser session.
|
|
324
324
|
* @param sessionId Browser session id.
|
|
325
|
-
* @param args Code and
|
|
326
|
-
* @returns Execution result.
|
|
325
|
+
* @param args Code, language ("python" | "node" | "bash"), and optional timeout.
|
|
326
|
+
* @returns Execution result including stdout, stderr, exitCode, and killed status.
|
|
327
327
|
*/
|
|
328
328
|
async browserExecute(
|
|
329
329
|
sessionId: string,
|
|
@@ -10,14 +10,14 @@ import { normalizeAxiosError, throwForBadResponse } from "../utils/errorHandler"
|
|
|
10
10
|
export async function browser(
|
|
11
11
|
http: HttpClient,
|
|
12
12
|
args: {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
ttl?: number;
|
|
14
|
+
activityTtl?: number;
|
|
15
15
|
streamWebView?: boolean;
|
|
16
16
|
} = {}
|
|
17
17
|
): Promise<BrowserCreateResponse> {
|
|
18
18
|
const body: Record<string, unknown> = {};
|
|
19
|
-
if (args.
|
|
20
|
-
if (args.
|
|
19
|
+
if (args.ttl != null) body.ttl = args.ttl;
|
|
20
|
+
if (args.activityTtl != null) body.activityTtl = args.activityTtl;
|
|
21
21
|
if (args.streamWebView != null) body.streamWebView = args.streamWebView;
|
|
22
22
|
|
|
23
23
|
try {
|
|
@@ -35,13 +35,15 @@ export async function browserExecute(
|
|
|
35
35
|
sessionId: string,
|
|
36
36
|
args: {
|
|
37
37
|
code: string;
|
|
38
|
-
language?: "python" | "
|
|
38
|
+
language?: "python" | "node" | "bash";
|
|
39
|
+
timeout?: number;
|
|
39
40
|
}
|
|
40
41
|
): Promise<BrowserExecuteResponse> {
|
|
41
42
|
const body: Record<string, unknown> = {
|
|
42
43
|
code: args.code,
|
|
43
|
-
language: args.language ?? "
|
|
44
|
+
language: args.language ?? "bash",
|
|
44
45
|
};
|
|
46
|
+
if (args.timeout != null) body.timeout = args.timeout;
|
|
45
47
|
|
|
46
48
|
try {
|
|
47
49
|
const res = await http.post<BrowserExecuteResponse>(
|
package/src/v2/types.ts
CHANGED
|
@@ -689,17 +689,25 @@ export interface BrowserCreateResponse {
|
|
|
689
689
|
success: boolean;
|
|
690
690
|
id?: string;
|
|
691
691
|
cdpUrl?: string;
|
|
692
|
+
liveViewUrl?: string;
|
|
693
|
+
expiresAt?: string;
|
|
692
694
|
error?: string;
|
|
693
695
|
}
|
|
694
696
|
|
|
695
697
|
export interface BrowserExecuteResponse {
|
|
696
698
|
success: boolean;
|
|
699
|
+
stdout?: string;
|
|
697
700
|
result?: string;
|
|
701
|
+
stderr?: string;
|
|
702
|
+
exitCode?: number;
|
|
703
|
+
killed?: boolean;
|
|
698
704
|
error?: string;
|
|
699
705
|
}
|
|
700
706
|
|
|
701
707
|
export interface BrowserDeleteResponse {
|
|
702
708
|
success: boolean;
|
|
709
|
+
sessionDurationMs?: number;
|
|
710
|
+
creditsBilled?: number;
|
|
703
711
|
error?: string;
|
|
704
712
|
}
|
|
705
713
|
|
|
@@ -707,6 +715,7 @@ export interface BrowserSession {
|
|
|
707
715
|
id: string;
|
|
708
716
|
status: string;
|
|
709
717
|
cdpUrl: string;
|
|
718
|
+
liveViewUrl: string;
|
|
710
719
|
streamWebView: boolean;
|
|
711
720
|
createdAt: string;
|
|
712
721
|
lastActivity: string;
|