@mendable/firecrawl 4.9.0 → 4.9.1
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-KS6E546Q.js → chunk-POKQQMNV.js} +1 -1
- package/dist/index.cjs +19 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +20 -2
- package/dist/{package-F4K5ZEVR.js → package-YGCUU3YI.js} +1 -1
- package/package.json +1 -1
- package/src/v2/client.ts +9 -1
- package/src/v2/methods/agent.ts +11 -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.9.
|
|
11
|
+
version: "4.9.1",
|
|
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.9.
|
|
38
|
+
version: "4.9.1",
|
|
39
39
|
description: "JavaScript SDK for Firecrawl API",
|
|
40
40
|
main: "dist/index.js",
|
|
41
41
|
types: "dist/index.d.ts",
|
|
@@ -801,6 +801,16 @@ async function agent(http, args) {
|
|
|
801
801
|
if (!jobId) return started;
|
|
802
802
|
return waitAgent(http, jobId, args.pollInterval ?? 2, args.timeout);
|
|
803
803
|
}
|
|
804
|
+
async function cancelAgent(http, jobId) {
|
|
805
|
+
try {
|
|
806
|
+
const res = await http.delete(`/v2/agent/${jobId}`);
|
|
807
|
+
if (res.status !== 200) throwForBadResponse(res, "cancel agent");
|
|
808
|
+
return res.data?.success === true;
|
|
809
|
+
} catch (err) {
|
|
810
|
+
if (err?.isAxiosError) return normalizeAxiosError(err, "cancel agent");
|
|
811
|
+
throw err;
|
|
812
|
+
}
|
|
813
|
+
}
|
|
804
814
|
|
|
805
815
|
// src/v2/methods/usage.ts
|
|
806
816
|
async function getConcurrency(http) {
|
|
@@ -1287,6 +1297,14 @@ var FirecrawlClient = class {
|
|
|
1287
1297
|
async agent(args) {
|
|
1288
1298
|
return agent(this.http, args);
|
|
1289
1299
|
}
|
|
1300
|
+
/**
|
|
1301
|
+
* Cancel an agent job.
|
|
1302
|
+
* @param jobId Agent job id.
|
|
1303
|
+
* @returns True if cancelled.
|
|
1304
|
+
*/
|
|
1305
|
+
async cancelAgent(jobId) {
|
|
1306
|
+
return cancelAgent(this.http, jobId);
|
|
1307
|
+
}
|
|
1290
1308
|
// Usage
|
|
1291
1309
|
/** Current concurrency usage. */
|
|
1292
1310
|
async getConcurrency() {
|
package/dist/index.d.cts
CHANGED
|
@@ -788,6 +788,12 @@ declare class FirecrawlClient {
|
|
|
788
788
|
pollInterval?: number;
|
|
789
789
|
timeout?: number;
|
|
790
790
|
}): Promise<AgentStatusResponse>;
|
|
791
|
+
/**
|
|
792
|
+
* Cancel an agent job.
|
|
793
|
+
* @param jobId Agent job id.
|
|
794
|
+
* @returns True if cancelled.
|
|
795
|
+
*/
|
|
796
|
+
cancelAgent(jobId: string): Promise<boolean>;
|
|
791
797
|
/** Current concurrency usage. */
|
|
792
798
|
getConcurrency(): Promise<ConcurrencyCheck>;
|
|
793
799
|
/** Current credit usage. */
|
package/dist/index.d.ts
CHANGED
|
@@ -788,6 +788,12 @@ declare class FirecrawlClient {
|
|
|
788
788
|
pollInterval?: number;
|
|
789
789
|
timeout?: number;
|
|
790
790
|
}): Promise<AgentStatusResponse>;
|
|
791
|
+
/**
|
|
792
|
+
* Cancel an agent job.
|
|
793
|
+
* @param jobId Agent job id.
|
|
794
|
+
* @returns True if cancelled.
|
|
795
|
+
*/
|
|
796
|
+
cancelAgent(jobId: string): Promise<boolean>;
|
|
791
797
|
/** Current concurrency usage. */
|
|
792
798
|
getConcurrency(): Promise<ConcurrencyCheck>;
|
|
793
799
|
/** Current credit usage. */
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
require_package
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-POKQQMNV.js";
|
|
4
4
|
|
|
5
5
|
// src/v2/utils/httpClient.ts
|
|
6
6
|
import axios from "axios";
|
|
@@ -683,6 +683,16 @@ async function agent(http, args) {
|
|
|
683
683
|
if (!jobId) return started;
|
|
684
684
|
return waitAgent(http, jobId, args.pollInterval ?? 2, args.timeout);
|
|
685
685
|
}
|
|
686
|
+
async function cancelAgent(http, jobId) {
|
|
687
|
+
try {
|
|
688
|
+
const res = await http.delete(`/v2/agent/${jobId}`);
|
|
689
|
+
if (res.status !== 200) throwForBadResponse(res, "cancel agent");
|
|
690
|
+
return res.data?.success === true;
|
|
691
|
+
} catch (err) {
|
|
692
|
+
if (err?.isAxiosError) return normalizeAxiosError(err, "cancel agent");
|
|
693
|
+
throw err;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
686
696
|
|
|
687
697
|
// src/v2/methods/usage.ts
|
|
688
698
|
async function getConcurrency(http) {
|
|
@@ -1169,6 +1179,14 @@ var FirecrawlClient = class {
|
|
|
1169
1179
|
async agent(args) {
|
|
1170
1180
|
return agent(this.http, args);
|
|
1171
1181
|
}
|
|
1182
|
+
/**
|
|
1183
|
+
* Cancel an agent job.
|
|
1184
|
+
* @param jobId Agent job id.
|
|
1185
|
+
* @returns True if cancelled.
|
|
1186
|
+
*/
|
|
1187
|
+
async cancelAgent(jobId) {
|
|
1188
|
+
return cancelAgent(this.http, jobId);
|
|
1189
|
+
}
|
|
1172
1190
|
// Usage
|
|
1173
1191
|
/** Current concurrency usage. */
|
|
1174
1192
|
async getConcurrency() {
|
|
@@ -1239,7 +1257,7 @@ var FirecrawlApp = class {
|
|
|
1239
1257
|
if (typeof process !== "undefined" && process.env && process.env.npm_package_version) {
|
|
1240
1258
|
return process.env.npm_package_version;
|
|
1241
1259
|
}
|
|
1242
|
-
const packageJson = await import("./package-
|
|
1260
|
+
const packageJson = await import("./package-YGCUU3YI.js");
|
|
1243
1261
|
return packageJson.default.version;
|
|
1244
1262
|
} catch (error) {
|
|
1245
1263
|
const isTest = typeof process !== "undefined" && (process.env.JEST_WORKER_ID != null || false);
|
package/package.json
CHANGED
package/src/v2/client.ts
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
batchScrape as batchWaiter,
|
|
20
20
|
} from "./methods/batch";
|
|
21
21
|
import { startExtract, getExtractStatus, extract as extractWaiter } from "./methods/extract";
|
|
22
|
-
import { startAgent, getAgentStatus, agent as agentWaiter } from "./methods/agent";
|
|
22
|
+
import { startAgent, getAgentStatus, cancelAgent, agent as agentWaiter } from "./methods/agent";
|
|
23
23
|
import { getConcurrency, getCreditUsage, getQueueStatus, getTokenUsage, getCreditUsageHistorical, getTokenUsageHistorical } from "./methods/usage";
|
|
24
24
|
import type {
|
|
25
25
|
Document,
|
|
@@ -289,6 +289,14 @@ export class FirecrawlClient {
|
|
|
289
289
|
async agent(args: Parameters<typeof startAgent>[1] & { pollInterval?: number; timeout?: number }): Promise<AgentStatusResponse> {
|
|
290
290
|
return agentWaiter(this.http, args);
|
|
291
291
|
}
|
|
292
|
+
/**
|
|
293
|
+
* Cancel an agent job.
|
|
294
|
+
* @param jobId Agent job id.
|
|
295
|
+
* @returns True if cancelled.
|
|
296
|
+
*/
|
|
297
|
+
async cancelAgent(jobId: string): Promise<boolean> {
|
|
298
|
+
return cancelAgent(this.http, jobId);
|
|
299
|
+
}
|
|
292
300
|
|
|
293
301
|
// Usage
|
|
294
302
|
/** Current concurrency usage. */
|
package/src/v2/methods/agent.ts
CHANGED
|
@@ -69,3 +69,14 @@ export async function agent(
|
|
|
69
69
|
if (!jobId) return started as unknown as AgentStatusResponse;
|
|
70
70
|
return waitAgent(http, jobId, args.pollInterval ?? 2, args.timeout);
|
|
71
71
|
}
|
|
72
|
+
|
|
73
|
+
export async function cancelAgent(http: HttpClient, jobId: string): Promise<boolean> {
|
|
74
|
+
try {
|
|
75
|
+
const res = await http.delete<{ success: boolean }>(`/v2/agent/${jobId}`);
|
|
76
|
+
if (res.status !== 200) throwForBadResponse(res, "cancel agent");
|
|
77
|
+
return res.data?.success === true;
|
|
78
|
+
} catch (err: any) {
|
|
79
|
+
if (err?.isAxiosError) return normalizeAxiosError(err, "cancel agent");
|
|
80
|
+
throw err;
|
|
81
|
+
}
|
|
82
|
+
}
|