diff --git a/sdks/javascript.mdx b/sdks/javascript.mdx index 1c24c9b..f348ca8 100644 --- a/sdks/javascript.mdx +++ b/sdks/javascript.mdx @@ -20,14 +20,18 @@ icon: "js" -These docs cover **`scrapegraph-js` ≥ 2.0.1**. The v2 SDK is **ESM-only** and requires **Node ≥ 22**. Earlier `0.x`/`1.x` releases expose a different, deprecated API. +These docs cover **`scrapegraph-js` ≥ 2.1.0**. The v2 SDK is **ESM-only** and requires **Node ≥ 22**. Earlier `0.x`/`1.x` releases expose a different, deprecated API. + +**Breaking in 2.1.0 (types only):** all exported TypeScript types and Zod schemas dropped the `Api` prefix and now match `scrapegraph-py` 1:1 (`ApiScrapeRequest` → `ScrapeRequest`, `ApiFetchConfig` → `FetchConfig`, `apiScrapeRequestSchema` → `scrapeRequestSchema`, etc.). Monitor input types are also renamed: `ApiMonitorCreateInput` → `MonitorCreateRequest`, `ApiMonitorUpdateInput` → `MonitorUpdateRequest`, `ApiMonitorActivityParams` → `MonitorActivityRequest`. `ApiResult` is the only type that keeps the prefix. Runtime JS code is unchanged — only TypeScript consumers need to rename imports. + + ## Installation ```bash # npm -npm i scrapegraph-js@latest # pins a version >= 2.0.1 +npm i scrapegraph-js@latest # pins a version >= 2.1.0 # pnpm pnpm add scrapegraph-js@latest @@ -117,12 +121,12 @@ const res = await sgai.scrape({ #### Parameters -| Parameter | Type | Required | Description | -| ------------- | --------------- | -------- | ------------------------------------------------------------- | -| `url` | `string` | Yes | URL to scrape | -| `formats` | `FormatEntry[]` | No | Defaults to `[{ type: "markdown" }]` | -| `contentType` | `string` | No | Override detected content type (e.g. `"application/pdf"`) | -| `fetchConfig` | `FetchConfig` | No | Fetch configuration | +| Parameter | Type | Required | Description | +| ------------- | ---------------- | -------- | ------------------------------------------------------------- | +| `url` | `string` | Yes | URL to scrape | +| `formats` | `FormatConfig[]` | No | Defaults to `[{ type: "markdown" }]` | +| `contentType` | `string` | No | Override detected content type (e.g. `"application/pdf"`) | +| `fetchConfig` | `FetchConfig` | No | Fetch configuration | **Formats:** - `markdown` — Clean markdown (modes: `normal`, `reader`, `prune`) @@ -290,18 +294,18 @@ await sgai.crawl.delete(crawlId); #### `crawl.start()` parameters -| Parameter | Type | Required | Description | -| ------------------ | --------------- | -------- | -------------------------------------------------------- | -| `url` | `string` | Yes | Starting URL | -| `formats` | `FormatEntry[]` | No | Defaults to `[{ type: "markdown" }]` | -| `maxDepth` | `number` | No | Maximum crawl depth. Default: `2` | -| `maxPages` | `number` | No | Maximum pages (1–1000). Default: `50` | -| `maxLinksPerPage` | `number` | No | Links followed per page. Default: `10` | -| `allowExternal` | `boolean` | No | Allow crossing domains. Default: `false` | -| `includePatterns` | `string[]` | No | URL patterns to include | -| `excludePatterns` | `string[]` | No | URL patterns to exclude | -| `contentTypes` | `string[]` | No | Allowed content types | -| `fetchConfig` | `FetchConfig` | No | Fetch configuration | +| Parameter | Type | Required | Description | +| ------------------ | ---------------- | -------- | -------------------------------------------------------- | +| `url` | `string` | Yes | Starting URL | +| `formats` | `FormatConfig[]` | No | Defaults to `[{ type: "markdown" }]` | +| `maxDepth` | `number` | No | Maximum crawl depth. Default: `2` | +| `maxPages` | `number` | No | Maximum pages (1–1000). Default: `50` | +| `maxLinksPerPage` | `number` | No | Links followed per page. Default: `10` | +| `allowExternal` | `boolean` | No | Allow crossing domains. Default: `false` | +| `includePatterns` | `string[]` | No | URL patterns to include | +| `excludePatterns` | `string[]` | No | URL patterns to exclude | +| `contentTypes` | `string[]` | No | Allowed content types | +| `fetchConfig` | `FetchConfig` | No | Fetch configuration | ### `sgai.monitor.*` diff --git a/services/crawl.mdx b/services/crawl.mdx index 14f4c6c..81d1529 100644 --- a/services/crawl.mdx +++ b/services/crawl.mdx @@ -231,7 +231,7 @@ asyncio.run(main()) ### Official SDKs - [Python SDK](/sdks/python) -- [JavaScript SDK](/sdks/javascript) (`scrapegraph-js` ≥ 2.0.1, Node ≥ 22) +- [JavaScript SDK](/sdks/javascript) (`scrapegraph-js` ≥ 2.1.0, Node ≥ 22) ### AI Framework Integrations - [LangChain Integration](/integrations/langchain) diff --git a/services/extract.mdx b/services/extract.mdx index d851cbf..b2abd5f 100644 --- a/services/extract.mdx +++ b/services/extract.mdx @@ -244,7 +244,7 @@ asyncio.run(main()) ### Official SDKs - [Python SDK](/sdks/python) -- [JavaScript SDK](/sdks/javascript) (`scrapegraph-js` ≥ 2.0.1, Node ≥ 22) +- [JavaScript SDK](/sdks/javascript) (`scrapegraph-js` ≥ 2.1.0, Node ≥ 22) ### AI Framework Integrations - [LangChain Integration](/integrations/langchain) diff --git a/services/monitor.mdx b/services/monitor.mdx index 3dfb89c..30d3255 100644 --- a/services/monitor.mdx +++ b/services/monitor.mdx @@ -222,7 +222,7 @@ asyncio.run(main()) ### Official SDKs - [Python SDK](/sdks/python) -- [JavaScript SDK](/sdks/javascript) (`scrapegraph-js` ≥ 2.0.1, Node ≥ 22) +- [JavaScript SDK](/sdks/javascript) (`scrapegraph-js` ≥ 2.1.0, Node ≥ 22) ## Support & Resources diff --git a/services/scrape.mdx b/services/scrape.mdx index 9052ac4..c7f3ef7 100644 --- a/services/scrape.mdx +++ b/services/scrape.mdx @@ -340,7 +340,7 @@ asyncio.run(main()) ### Official SDKs - [Python SDK](/sdks/python) — perfect for automation and data processing -- [JavaScript SDK](/sdks/javascript) — ideal for web applications and Node.js (`scrapegraph-js` ≥ 2.0.1, Node ≥ 22) +- [JavaScript SDK](/sdks/javascript) — ideal for web applications and Node.js (`scrapegraph-js` ≥ 2.1.0, Node ≥ 22) ### AI Framework Integrations - [LangChain Integration](/integrations/langchain) — use Scrape in your content pipelines diff --git a/services/search.mdx b/services/search.mdx index e99e7b9..eda7127 100644 --- a/services/search.mdx +++ b/services/search.mdx @@ -199,7 +199,7 @@ asyncio.run(main()) ### Official SDKs - [Python SDK](/sdks/python) -- [JavaScript SDK](/sdks/javascript) (`scrapegraph-js` ≥ 2.0.1, Node ≥ 22) +- [JavaScript SDK](/sdks/javascript) (`scrapegraph-js` ≥ 2.1.0, Node ≥ 22) ### AI Framework Integrations - [LangChain Integration](/integrations/langchain) diff --git a/transition-from-v1-to-v2.mdx b/transition-from-v1-to-v2.mdx index 443559c..155537d 100644 --- a/transition-from-v1-to-v2.mdx +++ b/transition-from-v1-to-v2.mdx @@ -231,7 +231,7 @@ Exact paths and payloads are listed under each service (for example [Scrape](/se 1. Log in at [scrapegraphai.com/login](https://scrapegraphai.com/login) 2. Start from [Introduction](/introduction) 3. Follow [Installation](/install) -4. Upgrade packages: `pip install -U scrapegraph-py` / `npm i scrapegraph-js@latest` (requires **`scrapegraph-js` ≥ 2.0.1** and **Node ≥ 22**) +4. Upgrade packages: `pip install -U scrapegraph-py` / `npm i scrapegraph-js@latest` (requires **`scrapegraph-js` ≥ 2.1.0** and **Node ≥ 22**) ## SDK migration guides (detailed changelogs)