@render-lab/tasks-scrape 0.1.2 → 0.2.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/LICENSE +21 -0
- package/dist/crawl.d.ts +3 -2
- package/dist/crawl.d.ts.map +1 -1
- package/dist/crawl.js +2 -2
- package/dist/crawl.js.map +1 -1
- package/dist/extract.d.ts +3 -2
- package/dist/extract.d.ts.map +1 -1
- package/dist/extract.js +1 -1
- package/dist/extract.js.map +1 -1
- package/dist/fetch.d.ts +1 -1
- package/dist/fetch.d.ts.map +1 -1
- package/dist/fetchCore.d.ts +2 -1
- package/dist/fetchCore.d.ts.map +1 -1
- package/dist/fetchCore.js +1 -1
- package/dist/fetchCore.js.map +1 -1
- package/dist/links.d.ts +3 -2
- package/dist/links.d.ts.map +1 -1
- package/dist/links.js +2 -2
- package/dist/links.js.map +1 -1
- package/dist/metadata.d.ts +3 -2
- package/dist/metadata.d.ts.map +1 -1
- package/dist/metadata.js +2 -2
- package/dist/metadata.js.map +1 -1
- package/dist/sitemap.d.ts +3 -2
- package/dist/sitemap.d.ts.map +1 -1
- package/dist/sitemap.js +2 -2
- package/dist/sitemap.js.map +1 -1
- package/dist/toMarkdown.d.ts +3 -2
- package/dist/toMarkdown.d.ts.map +1 -1
- package/dist/toMarkdown.js +2 -2
- package/dist/toMarkdown.js.map +1 -1
- package/package.json +13 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Render Lab
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/crawl.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type TaskContext } from "@renderinc/sdk/workflows";
|
|
1
2
|
import { type ScrapeDeps } from "./client.js";
|
|
2
3
|
import type { CrawlInput, CrawlResult } from "./types.js";
|
|
3
4
|
/**
|
|
@@ -6,7 +7,7 @@ import type { CrawlInput, CrawlResult } from "./types.js";
|
|
|
6
7
|
* and stop at `maxPages`. Visited URLs are de-duplicated. Kept a single bounded loop
|
|
7
8
|
* so the whole crawl is one durable run.
|
|
8
9
|
*/
|
|
9
|
-
export declare function crawlImpl(input: CrawlInput, deps?: ScrapeDeps): Promise<CrawlResult>;
|
|
10
|
+
export declare function crawlImpl(ctx: TaskContext, input: CrawlInput, deps?: ScrapeDeps): Promise<CrawlResult>;
|
|
10
11
|
/** Bounded BFS crawl following same-host links from a start URL. */
|
|
11
|
-
export declare const crawl: import("@renderinc/sdk/workflows").
|
|
12
|
+
export declare const crawl: import("@renderinc/sdk/workflows").TaskDefinition<[input: CrawlInput, deps?: ScrapeDeps | undefined], CrawlResult>;
|
|
12
13
|
//# sourceMappingURL=crawl.d.ts.map
|
package/dist/crawl.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crawl.d.ts","sourceRoot":"","sources":["../src/crawl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"crawl.d.ts","sourceRoot":"","sources":["../src/crawl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAU1D;;;;;GAKG;AACH,wBAAsB,SAAS,CAC7B,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,UAAU,EACjB,IAAI,GAAE,UAAwB,GAC7B,OAAO,CAAC,WAAW,CAAC,CAyBtB;AAED,oEAAoE;AACpE,eAAO,MAAM,KAAK,oHAGjB,CAAC"}
|
package/dist/crawl.js
CHANGED
|
@@ -17,7 +17,7 @@ function hostOf(url) {
|
|
|
17
17
|
* and stop at `maxPages`. Visited URLs are de-duplicated. Kept a single bounded loop
|
|
18
18
|
* so the whole crawl is one durable run.
|
|
19
19
|
*/
|
|
20
|
-
export async function crawlImpl(input, deps = defaultDeps) {
|
|
20
|
+
export async function crawlImpl(ctx, input, deps = defaultDeps) {
|
|
21
21
|
const maxPages = input.maxPages ?? 10;
|
|
22
22
|
const sameHost = input.sameHost ?? true;
|
|
23
23
|
const startHost = hostOf(input.startUrl);
|
|
@@ -29,7 +29,7 @@ export async function crawlImpl(input, deps = defaultDeps) {
|
|
|
29
29
|
if (visited.has(next))
|
|
30
30
|
continue;
|
|
31
31
|
visited.add(next);
|
|
32
|
-
const res = await fetchUrlImpl({ url: next, headers: input.headers }, deps);
|
|
32
|
+
const res = await fetchUrlImpl(ctx, { url: next, headers: input.headers }, deps);
|
|
33
33
|
if (!res.ok)
|
|
34
34
|
continue; // skip client errors; retryable statuses already threw
|
|
35
35
|
pages.push({ url: res.url, title: extractTitle(res.body) });
|
package/dist/crawl.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crawl.js","sourceRoot":"","sources":["../src/crawl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"crawl.js","sourceRoot":"","sources":["../src/crawl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAoB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,WAAW,EAAmB,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG1C,SAAS,MAAM,CAAC,GAAW;IACzB,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;IAC3B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,GAAgB,EAChB,KAAiB,EACjB,OAAmB,WAAW;IAE9B,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC;IACtC,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC;IACxC,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACzC,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,MAAM,KAAK,GAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACzC,MAAM,KAAK,GAAqC,EAAE,CAAC;IAEnD,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,QAAQ,EAAE,CAAC;QACnD,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,EAAG,CAAC;QAC5B,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,SAAS;QAChC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAElB,MAAM,GAAG,GAAG,MAAM,YAAY,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC,CAAC;QACjF,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,SAAS,CAAC,uDAAuD;QAC9E,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAE5D,KAAK,MAAM,IAAI,IAAI,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACnD,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;gBAAE,SAAS;YAChC,IAAI,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,SAAS;gBAAE,SAAS;YACrD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,CAAC;AACnB,CAAC;AAED,oEAAoE;AACpE,MAAM,CAAC,MAAM,KAAK,GAAG,IAAI,CACvB,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,EAAE,EAC7C,SAAS,CACV,CAAC"}
|
package/dist/extract.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { type TaskContext } from "@renderinc/sdk/workflows";
|
|
1
2
|
import type { ExtractInput, ExtractResult } from "./types.js";
|
|
2
3
|
/** Raw implementation of scrape.extract. Pure CPU work, so no retry policy. */
|
|
3
|
-
export declare function extractImpl(input: ExtractInput): Promise<ExtractResult>;
|
|
4
|
+
export declare function extractImpl(ctx: TaskContext, input: ExtractInput): Promise<ExtractResult>;
|
|
4
5
|
/** Pull title, visible text, and links out of HTML. */
|
|
5
|
-
export declare const extractContent: import("@renderinc/sdk/workflows").
|
|
6
|
+
export declare const extractContent: import("@renderinc/sdk/workflows").TaskDefinition<[input: ExtractInput], ExtractResult>;
|
|
6
7
|
//# sourceMappingURL=extract.d.ts.map
|
package/dist/extract.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../src/extract.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../src/extract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE9D,+EAA+E;AAC/E,wBAAsB,WAAW,CAAC,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CAE/F;AAED,uDAAuD;AACvD,eAAO,MAAM,cAAc,yFAAgD,CAAC"}
|
package/dist/extract.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { task } from "@renderinc/sdk/workflows";
|
|
2
2
|
import { extract } from "./html.js";
|
|
3
3
|
/** Raw implementation of scrape.extract. Pure CPU work, so no retry policy. */
|
|
4
|
-
export async function extractImpl(input) {
|
|
4
|
+
export async function extractImpl(ctx, input) {
|
|
5
5
|
return extract(input.html, input.baseUrl);
|
|
6
6
|
}
|
|
7
7
|
/** Pull title, visible text, and links out of HTML. */
|
package/dist/extract.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract.js","sourceRoot":"","sources":["../src/extract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"extract.js","sourceRoot":"","sources":["../src/extract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAoB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,+EAA+E;AAC/E,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,GAAgB,EAAE,KAAmB;IACrE,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;AAC5C,CAAC;AAED,uDAAuD;AACvD,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,EAAE,WAAW,CAAC,CAAC"}
|
package/dist/fetch.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { fetchUrlImpl } from "./fetchCore.js";
|
|
2
2
|
/** Fetch a URL and return status + body. */
|
|
3
|
-
export declare const fetchUrl: import("@renderinc/sdk/workflows").
|
|
3
|
+
export declare const fetchUrl: import("@renderinc/sdk/workflows").TaskDefinition<[input: import("./types.js").FetchInput, deps?: import("./client.js").ScrapeDeps | undefined], import("./types.js").FetchResult>;
|
|
4
4
|
//# sourceMappingURL=fetch.d.ts.map
|
package/dist/fetch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,4CAA4C;AAC5C,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,4CAA4C;AAC5C,eAAO,MAAM,QAAQ,oLAGpB,CAAC"}
|
package/dist/fetchCore.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TaskContext } from "@renderinc/sdk/workflows";
|
|
1
2
|
import { type ScrapeDeps } from "./client.js";
|
|
2
3
|
import type { FetchInput, FetchResult } from "./types.js";
|
|
3
4
|
/**
|
|
@@ -9,5 +10,5 @@ import type { FetchInput, FetchResult } from "./types.js";
|
|
|
9
10
|
* metadata, …) can reuse the fetch logic without importing fetch.js and
|
|
10
11
|
* registering scrape.fetch as a side effect of their own subpath.
|
|
11
12
|
*/
|
|
12
|
-
export declare function fetchUrlImpl(input: FetchInput, deps?: ScrapeDeps): Promise<FetchResult>;
|
|
13
|
+
export declare function fetchUrlImpl(ctx: TaskContext, input: FetchInput, deps?: ScrapeDeps): Promise<FetchResult>;
|
|
13
14
|
//# sourceMappingURL=fetchCore.d.ts.map
|
package/dist/fetchCore.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchCore.d.ts","sourceRoot":"","sources":["../src/fetchCore.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetchCore.d.ts","sourceRoot":"","sources":["../src/fetchCore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE1D;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAChC,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,UAAU,EACjB,IAAI,GAAE,UAAwB,GAC7B,OAAO,CAAC,WAAW,CAAC,CAMtB"}
|
package/dist/fetchCore.js
CHANGED
|
@@ -9,7 +9,7 @@ import { defaultDeps } from "./client.js";
|
|
|
9
9
|
* metadata, …) can reuse the fetch logic without importing fetch.js and
|
|
10
10
|
* registering scrape.fetch as a side effect of their own subpath.
|
|
11
11
|
*/
|
|
12
|
-
export async function fetchUrlImpl(input, deps = defaultDeps) {
|
|
12
|
+
export async function fetchUrlImpl(ctx, input, deps = defaultDeps) {
|
|
13
13
|
const res = await deps.scrape.fetch(input.url, input.headers);
|
|
14
14
|
if (isRetryable(res.status)) {
|
|
15
15
|
throw new Error(`scrape.fetch ${input.url} failed: ${res.status}`);
|
package/dist/fetchCore.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchCore.js","sourceRoot":"","sources":["../src/fetchCore.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetchCore.js","sourceRoot":"","sources":["../src/fetchCore.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAmB,MAAM,aAAa,CAAC;AAG3D;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,GAAgB,EAChB,KAAiB,EACjB,OAAmB,WAAW;IAE9B,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAC9D,IAAI,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,gBAAgB,KAAK,CAAC,GAAG,YAAY,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/links.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { type TaskContext } from "@renderinc/sdk/workflows";
|
|
1
2
|
import { type ScrapeDeps } from "./client.js";
|
|
2
3
|
import type { FetchInput, LinksResult } from "./types.js";
|
|
3
4
|
/**
|
|
4
5
|
* Raw implementation of scrape.extractLinks. Fetches the page and returns its
|
|
5
6
|
* de-duplicated absolute links, resolved against the final URL.
|
|
6
7
|
*/
|
|
7
|
-
export declare function extractPageLinksImpl(input: FetchInput, deps?: ScrapeDeps): Promise<LinksResult>;
|
|
8
|
+
export declare function extractPageLinksImpl(ctx: TaskContext, input: FetchInput, deps?: ScrapeDeps): Promise<LinksResult>;
|
|
8
9
|
/** Fetch a URL and return its absolute links. */
|
|
9
|
-
export declare const extractPageLinks: import("@renderinc/sdk/workflows").
|
|
10
|
+
export declare const extractPageLinks: import("@renderinc/sdk/workflows").TaskDefinition<[input: FetchInput, deps?: ScrapeDeps | undefined], LinksResult>;
|
|
10
11
|
//# sourceMappingURL=links.d.ts.map
|
package/dist/links.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../src/links.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../src/links.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE1D;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,UAAU,EACjB,IAAI,GAAE,UAAwB,GAC7B,OAAO,CAAC,WAAW,CAAC,CAGtB;AAED,iDAAiD;AACjD,eAAO,MAAM,gBAAgB,oHAG5B,CAAC"}
|
package/dist/links.js
CHANGED
|
@@ -7,8 +7,8 @@ import { SCRAPE_RETRY } from "./retry.js";
|
|
|
7
7
|
* Raw implementation of scrape.extractLinks. Fetches the page and returns its
|
|
8
8
|
* de-duplicated absolute links, resolved against the final URL.
|
|
9
9
|
*/
|
|
10
|
-
export async function extractPageLinksImpl(input, deps = defaultDeps) {
|
|
11
|
-
const res = await fetchUrlImpl(input, deps);
|
|
10
|
+
export async function extractPageLinksImpl(ctx, input, deps = defaultDeps) {
|
|
11
|
+
const res = await fetchUrlImpl(ctx, input, deps);
|
|
12
12
|
return { url: res.url, links: extractLinks(res.body, res.url) };
|
|
13
13
|
}
|
|
14
14
|
/** Fetch a URL and return its absolute links. */
|
package/dist/links.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"links.js","sourceRoot":"","sources":["../src/links.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"links.js","sourceRoot":"","sources":["../src/links.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAoB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,WAAW,EAAmB,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG1C;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,GAAgB,EAChB,KAAiB,EACjB,OAAmB,WAAW;IAE9B,MAAM,GAAG,GAAG,MAAM,YAAY,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IACjD,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;AAClE,CAAC;AAED,iDAAiD;AACjD,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAClC,EAAE,IAAI,EAAE,qBAAqB,EAAE,KAAK,EAAE,YAAY,EAAE,EACpD,oBAAoB,CACrB,CAAC"}
|
package/dist/metadata.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { type TaskContext } from "@renderinc/sdk/workflows";
|
|
1
2
|
import { type ScrapeDeps } from "./client.js";
|
|
2
3
|
import type { FetchInput, MetadataResult } from "./types.js";
|
|
3
4
|
/**
|
|
4
5
|
* Raw implementation of scrape.extractMetadata. Fetches the page and parses its
|
|
5
6
|
* <title>, description, OpenGraph og:* tags, and canonical link.
|
|
6
7
|
*/
|
|
7
|
-
export declare function extractPageMetadataImpl(input: FetchInput, deps?: ScrapeDeps): Promise<MetadataResult>;
|
|
8
|
+
export declare function extractPageMetadataImpl(ctx: TaskContext, input: FetchInput, deps?: ScrapeDeps): Promise<MetadataResult>;
|
|
8
9
|
/** Fetch a URL and return its head metadata. */
|
|
9
|
-
export declare const extractPageMetadata: import("@renderinc/sdk/workflows").
|
|
10
|
+
export declare const extractPageMetadata: import("@renderinc/sdk/workflows").TaskDefinition<[input: FetchInput, deps?: ScrapeDeps | undefined], MetadataResult>;
|
|
10
11
|
//# sourceMappingURL=metadata.d.ts.map
|
package/dist/metadata.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE7D;;;GAGG;AACH,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,UAAU,EACjB,IAAI,GAAE,UAAwB,GAC7B,OAAO,CAAC,cAAc,CAAC,CAGzB;AAED,gDAAgD;AAChD,eAAO,MAAM,mBAAmB,uHAG/B,CAAC"}
|
package/dist/metadata.js
CHANGED
|
@@ -7,8 +7,8 @@ import { SCRAPE_RETRY } from "./retry.js";
|
|
|
7
7
|
* Raw implementation of scrape.extractMetadata. Fetches the page and parses its
|
|
8
8
|
* <title>, description, OpenGraph og:* tags, and canonical link.
|
|
9
9
|
*/
|
|
10
|
-
export async function extractPageMetadataImpl(input, deps = defaultDeps) {
|
|
11
|
-
const res = await fetchUrlImpl(input, deps);
|
|
10
|
+
export async function extractPageMetadataImpl(ctx, input, deps = defaultDeps) {
|
|
11
|
+
const res = await fetchUrlImpl(ctx, input, deps);
|
|
12
12
|
return { url: res.url, ...extractMetadata(res.body) };
|
|
13
13
|
}
|
|
14
14
|
/** Fetch a URL and return its head metadata. */
|
package/dist/metadata.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAoB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAmB,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG1C;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,GAAgB,EAChB,KAAiB,EACjB,OAAmB,WAAW;IAE9B,MAAM,GAAG,GAAG,MAAM,YAAY,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IACjD,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;AACxD,CAAC;AAED,gDAAgD;AAChD,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CACrC,EAAE,IAAI,EAAE,wBAAwB,EAAE,KAAK,EAAE,YAAY,EAAE,EACvD,uBAAuB,CACxB,CAAC"}
|
package/dist/sitemap.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { type TaskContext } from "@renderinc/sdk/workflows";
|
|
1
2
|
import { type ScrapeDeps } from "./client.js";
|
|
2
3
|
import type { FetchInput, SitemapResult } from "./types.js";
|
|
3
4
|
/**
|
|
4
5
|
* Raw implementation of scrape.sitemap. Fetches a sitemap.xml and returns the URLs
|
|
5
6
|
* from its <loc> entries (handles both <urlset> and <sitemapindex> documents).
|
|
6
7
|
*/
|
|
7
|
-
export declare function sitemapImpl(input: FetchInput, deps?: ScrapeDeps): Promise<SitemapResult>;
|
|
8
|
+
export declare function sitemapImpl(ctx: TaskContext, input: FetchInput, deps?: ScrapeDeps): Promise<SitemapResult>;
|
|
8
9
|
/** Fetch a sitemap.xml and return its listed URLs. */
|
|
9
|
-
export declare const sitemap: import("@renderinc/sdk/workflows").
|
|
10
|
+
export declare const sitemap: import("@renderinc/sdk/workflows").TaskDefinition<[input: FetchInput, deps?: ScrapeDeps | undefined], SitemapResult>;
|
|
10
11
|
//# sourceMappingURL=sitemap.d.ts.map
|
package/dist/sitemap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sitemap.d.ts","sourceRoot":"","sources":["../src/sitemap.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sitemap.d.ts","sourceRoot":"","sources":["../src/sitemap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE5D;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,UAAU,EACjB,IAAI,GAAE,UAAwB,GAC7B,OAAO,CAAC,aAAa,CAAC,CAGxB;AAED,sDAAsD;AACtD,eAAO,MAAM,OAAO,sHAGnB,CAAC"}
|
package/dist/sitemap.js
CHANGED
|
@@ -7,8 +7,8 @@ import { SCRAPE_RETRY } from "./retry.js";
|
|
|
7
7
|
* Raw implementation of scrape.sitemap. Fetches a sitemap.xml and returns the URLs
|
|
8
8
|
* from its <loc> entries (handles both <urlset> and <sitemapindex> documents).
|
|
9
9
|
*/
|
|
10
|
-
export async function sitemapImpl(input, deps = defaultDeps) {
|
|
11
|
-
const res = await fetchUrlImpl(input, deps);
|
|
10
|
+
export async function sitemapImpl(ctx, input, deps = defaultDeps) {
|
|
11
|
+
const res = await fetchUrlImpl(ctx, input, deps);
|
|
12
12
|
return { url: res.url, urls: parseSitemap(res.body) };
|
|
13
13
|
}
|
|
14
14
|
/** Fetch a sitemap.xml and return its listed URLs. */
|
package/dist/sitemap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sitemap.js","sourceRoot":"","sources":["../src/sitemap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"sitemap.js","sourceRoot":"","sources":["../src/sitemap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAoB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,WAAW,EAAmB,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG1C;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,GAAgB,EAChB,KAAiB,EACjB,OAAmB,WAAW;IAE9B,MAAM,GAAG,GAAG,MAAM,YAAY,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IACjD,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;AACxD,CAAC;AAED,sDAAsD;AACtD,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CACzB,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,YAAY,EAAE,EAC/C,WAAW,CACZ,CAAC"}
|
package/dist/toMarkdown.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { type TaskContext } from "@renderinc/sdk/workflows";
|
|
1
2
|
import { type ScrapeDeps } from "./client.js";
|
|
2
3
|
import type { FetchInput, ToMarkdownResult } from "./types.js";
|
|
3
4
|
/**
|
|
4
5
|
* Raw implementation of scrape.toMarkdown. Fetches the page (reusing scrape.fetch's
|
|
5
6
|
* retry-on-429/5xx semantics) and converts its main text to clean markdown.
|
|
6
7
|
*/
|
|
7
|
-
export declare function toMarkdownImpl(input: FetchInput, deps?: ScrapeDeps): Promise<ToMarkdownResult>;
|
|
8
|
+
export declare function toMarkdownImpl(ctx: TaskContext, input: FetchInput, deps?: ScrapeDeps): Promise<ToMarkdownResult>;
|
|
8
9
|
/** Fetch a URL and convert its content to markdown. */
|
|
9
|
-
export declare const toMarkdown: import("@renderinc/sdk/workflows").
|
|
10
|
+
export declare const toMarkdown: import("@renderinc/sdk/workflows").TaskDefinition<[input: FetchInput, deps?: ScrapeDeps | undefined], ToMarkdownResult>;
|
|
10
11
|
//# sourceMappingURL=toMarkdown.d.ts.map
|
package/dist/toMarkdown.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toMarkdown.d.ts","sourceRoot":"","sources":["../src/toMarkdown.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"toMarkdown.d.ts","sourceRoot":"","sources":["../src/toMarkdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE/D;;;GAGG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,UAAU,EACjB,IAAI,GAAE,UAAwB,GAC7B,OAAO,CAAC,gBAAgB,CAAC,CAO3B;AAED,uDAAuD;AACvD,eAAO,MAAM,UAAU,yHAGtB,CAAC"}
|
package/dist/toMarkdown.js
CHANGED
|
@@ -7,8 +7,8 @@ import { SCRAPE_RETRY } from "./retry.js";
|
|
|
7
7
|
* Raw implementation of scrape.toMarkdown. Fetches the page (reusing scrape.fetch's
|
|
8
8
|
* retry-on-429/5xx semantics) and converts its main text to clean markdown.
|
|
9
9
|
*/
|
|
10
|
-
export async function toMarkdownImpl(input, deps = defaultDeps) {
|
|
11
|
-
const res = await fetchUrlImpl(input, deps);
|
|
10
|
+
export async function toMarkdownImpl(ctx, input, deps = defaultDeps) {
|
|
11
|
+
const res = await fetchUrlImpl(ctx, input, deps);
|
|
12
12
|
return {
|
|
13
13
|
url: res.url,
|
|
14
14
|
title: extractTitle(res.body),
|
package/dist/toMarkdown.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toMarkdown.js","sourceRoot":"","sources":["../src/toMarkdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"toMarkdown.js","sourceRoot":"","sources":["../src/toMarkdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAoB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,WAAW,EAAmB,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG1C;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,GAAgB,EAChB,KAAiB,EACjB,OAAmB,WAAW;IAE9B,MAAM,GAAG,GAAG,MAAM,YAAY,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IACjD,OAAO;QACL,GAAG,EAAE,GAAG,CAAC,GAAG;QACZ,KAAK,EAAE,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC;QAC7B,QAAQ,EAAE,cAAc,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC;KAC5C,CAAC;AACJ,CAAC;AAED,uDAAuD;AACvD,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAC5B,EAAE,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAE,YAAY,EAAE,EAClD,cAAc,CACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@render-lab/tasks-scrape",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Durable web-scrape tasks for Render Workflows: scrape.fetch, scrape.extract.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/render-lab/render-tasks.git",
|
|
9
|
+
"directory": "packages/tasks-scrape"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/render-lab/render-tasks#readme",
|
|
5
12
|
"type": "module",
|
|
6
13
|
"main": "./dist/index.js",
|
|
7
14
|
"types": "./dist/index.d.ts",
|
|
@@ -19,16 +26,17 @@
|
|
|
19
26
|
"dist"
|
|
20
27
|
],
|
|
21
28
|
"peerDependencies": {
|
|
22
|
-
"@renderinc/sdk": "0.
|
|
29
|
+
"@renderinc/sdk": "^1.0.0"
|
|
23
30
|
},
|
|
24
31
|
"devDependencies": {
|
|
25
|
-
"@renderinc/sdk": "
|
|
32
|
+
"@renderinc/sdk": "1.11.0",
|
|
26
33
|
"@types/node": "^24.0.0",
|
|
27
34
|
"typescript": "^6.0.0",
|
|
28
|
-
"vitest": "^4.1.0"
|
|
35
|
+
"vitest": "^4.1.0",
|
|
36
|
+
"@render-lab/test-utils": "0.1.1"
|
|
29
37
|
},
|
|
30
38
|
"dependencies": {
|
|
31
|
-
"@render-lab/tasks-core": "0.1
|
|
39
|
+
"@render-lab/tasks-core": "0.3.1"
|
|
32
40
|
},
|
|
33
41
|
"scripts": {
|
|
34
42
|
"build": "tsc -p tsconfig.json",
|