firecrawl 4.29.1 → 4.29.2

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.
@@ -12,7 +12,7 @@ var require_package = __commonJS({
12
12
  "package.json"(exports, module) {
13
13
  module.exports = {
14
14
  name: "@mendable/firecrawl-js",
15
- version: "4.29.1",
15
+ version: "4.29.2",
16
16
  description: "JavaScript SDK for Firecrawl API",
17
17
  main: "dist/index.js",
18
18
  types: "dist/index.d.ts",
package/dist/index.cjs CHANGED
@@ -39,7 +39,7 @@ var require_package = __commonJS({
39
39
  "package.json"(exports2, module2) {
40
40
  module2.exports = {
41
41
  name: "@mendable/firecrawl-js",
42
- version: "4.29.1",
42
+ version: "4.29.2",
43
43
  description: "JavaScript SDK for Firecrawl API",
44
44
  main: "dist/index.js",
45
45
  types: "dist/index.d.ts",
@@ -1491,6 +1491,7 @@ function appendParam(params, key, value) {
1491
1491
  }
1492
1492
  }
1493
1493
  function withQuery(path, params) {
1494
+ params.append("origin", `js-sdk@${getVersion()}`);
1494
1495
  const qs = params.toString();
1495
1496
  return qs ? `${path}?${qs}` : path;
1496
1497
  }
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  require_package
3
- } from "./chunk-Y32NE3NV.js";
3
+ } from "./chunk-N3GO36OX.js";
4
4
 
5
5
  // src/v2/utils/httpClient.ts
6
6
  import axios from "axios";
@@ -1358,6 +1358,7 @@ function appendParam(params, key, value) {
1358
1358
  }
1359
1359
  }
1360
1360
  function withQuery(path, params) {
1361
+ params.append("origin", `js-sdk@${getVersion()}`);
1361
1362
  const qs = params.toString();
1362
1363
  return qs ? `${path}?${qs}` : path;
1363
1364
  }
@@ -2302,7 +2303,7 @@ var FirecrawlApp = class {
2302
2303
  if (typeof process !== "undefined" && process.env && process.env.npm_package_version) {
2303
2304
  return process.env.npm_package_version;
2304
2305
  }
2305
- const packageJson = await import("./package-GCDC7LJR.js");
2306
+ const packageJson = await import("./package-VAY7ZMTB.js");
2306
2307
  return packageJson.default.version;
2307
2308
  } catch (error) {
2308
2309
  const isTest = typeof process !== "undefined" && (process.env.JEST_WORKER_ID != null || false);
@@ -1,4 +1,4 @@
1
1
  import {
2
2
  require_package
3
- } from "./chunk-Y32NE3NV.js";
3
+ } from "./chunk-N3GO36OX.js";
4
4
  export default require_package();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "firecrawl",
3
- "version": "4.29.1",
3
+ "version": "4.29.2",
4
4
  "description": "JavaScript SDK for Firecrawl API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -53,7 +53,8 @@ describe("research.searchPapers", () => {
53
53
  const { client, calls } = makeClient(() => ({ status: 200, data: { results: [] } }));
54
54
  await client.searchPapers("q");
55
55
  const qs = new URLSearchParams(calls[0].split("?")[1]);
56
- expect([...qs.keys()]).toEqual(["query"]);
56
+ expect([...qs.keys()]).toEqual(["query", "origin"]);
57
+ expect(qs.get("origin")).toMatch(/^js-sdk@/);
57
58
  });
58
59
 
59
60
  test("rejects empty query", async () => {
@@ -74,10 +75,14 @@ describe("research.searchPapers", () => {
74
75
  });
75
76
 
76
77
  describe("research.getPaper", () => {
77
- test("detail mode encodes the id and sends no query params", async () => {
78
+ test("detail mode encodes the id and sends only the origin param", async () => {
78
79
  const { client, calls } = makeClient(() => ({ status: 200, data: { paper: {} } }));
79
80
  await client.getPaper("arxiv:2105.05233");
80
- expect(calls[0]).toBe("/v2/search/research/papers/arxiv%3A2105.05233");
81
+ const [path, query] = calls[0].split("?");
82
+ expect(path).toBe("/v2/search/research/papers/arxiv%3A2105.05233");
83
+ const qs = new URLSearchParams(query);
84
+ expect([...qs.keys()]).toEqual(["origin"]);
85
+ expect(qs.get("origin")).toMatch(/^js-sdk@/);
81
86
  });
82
87
 
83
88
  test("read mode adds query and k", async () => {
@@ -12,6 +12,7 @@ import type {
12
12
  import { SdkError } from "../types";
13
13
  import { HttpClient } from "../utils/httpClient";
14
14
  import { throwForBadResponse } from "../utils/errorHandler";
15
+ import { getVersion } from "../utils/getVersion";
15
16
 
16
17
  const BASE = "/v2/search/research";
17
18
 
@@ -32,6 +33,9 @@ function appendParam(
32
33
  }
33
34
 
34
35
  function withQuery(path: string, params: URLSearchParams): string {
36
+ // Research endpoints are GETs, so the POST-body origin injection in
37
+ // HttpClient never applies — attach it as a query param instead.
38
+ params.append("origin", `js-sdk@${getVersion()}`);
35
39
  const qs = params.toString();
36
40
  return qs ? `${path}?${qs}` : path;
37
41
  }