@render-lab/tasks-scrape 0.1.1 → 0.2.0

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/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").TaskFunction<[input: CrawlInput, deps?: ScrapeDeps | undefined], CrawlResult>;
12
+ export declare const crawl: import("@renderinc/sdk/workflows").TaskDefinition<[input: CrawlInput, deps?: ScrapeDeps | undefined], CrawlResult>;
12
13
  //# sourceMappingURL=crawl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"crawl.d.ts","sourceRoot":"","sources":["../src/crawl.ts"],"names":[],"mappings":"AAGA,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,KAAK,EAAE,UAAU,EACjB,IAAI,GAAE,UAAwB,GAC7B,OAAO,CAAC,WAAW,CAAC,CAyBtB;AAED,oEAAoE;AACpE,eAAO,MAAM,KAAK,kHAGjB,CAAC"}
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
@@ -1,5 +1,5 @@
1
1
  import { task } from "@renderinc/sdk/workflows";
2
- import { fetchUrlImpl } from "./fetch.js";
2
+ import { fetchUrlImpl } from "./fetchCore.js";
3
3
  import { extractLinks, extractTitle } from "./html.js";
4
4
  import { defaultDeps } from "./client.js";
5
5
  import { SCRAPE_RETRY } from "./retry.js";
@@ -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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AChC,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").TaskFunction<[input: ExtractInput], ExtractResult>;
6
+ export declare const extractContent: import("@renderinc/sdk/workflows").TaskDefinition<[input: ExtractInput], ExtractResult>;
6
7
  //# sourceMappingURL=extract.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../src/extract.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE9D,+EAA+E;AAC/E,wBAAsB,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CAE7E;AAED,uDAAuD;AACvD,eAAO,MAAM,cAAc,uFAAgD,CAAC"}
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. */
@@ -1 +1 @@
1
- {"version":3,"file":"extract.js","sourceRoot":"","sources":["../src/extract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,+EAA+E;AAC/E,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,KAAmB;IACnD,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"}
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,11 +1,4 @@
1
- import { type ScrapeDeps } from "./client.js";
2
- import type { FetchInput, FetchResult } from "./types.js";
3
- /**
4
- * Raw implementation of scrape.fetch. Throws on 429/5xx so the durable retry
5
- * policy re-runs the fetch; returns other non-2xx (e.g. 404) to the caller so a
6
- * genuine client error doesn't burn retries or fail the whole workflow.
7
- */
8
- export declare function fetchUrlImpl(input: FetchInput, deps?: ScrapeDeps): Promise<FetchResult>;
1
+ export { fetchUrlImpl } from "./fetchCore.js";
9
2
  /** Fetch a URL and return status + body. */
10
- export declare const fetchUrl: import("@renderinc/sdk/workflows").TaskFunction<[input: FetchInput, deps?: ScrapeDeps | undefined], FetchResult>;
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>;
11
4
  //# sourceMappingURL=fetch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE1D;;;;GAIG;AACH,wBAAsB,YAAY,CAChC,KAAK,EAAE,UAAU,EACjB,IAAI,GAAE,UAAwB,GAC7B,OAAO,CAAC,WAAW,CAAC,CAMtB;AAED,4CAA4C;AAC5C,eAAO,MAAM,QAAQ,kHAGpB,CAAC"}
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/fetch.js CHANGED
@@ -1,19 +1,9 @@
1
1
  import { task } from "@renderinc/sdk/workflows";
2
- import { isRetryable } from "@render-lab/tasks-core";
3
- import { defaultDeps } from "./client.js";
4
2
  import { SCRAPE_RETRY } from "./retry.js";
5
- /**
6
- * Raw implementation of scrape.fetch. Throws on 429/5xx so the durable retry
7
- * policy re-runs the fetch; returns other non-2xx (e.g. 404) to the caller so a
8
- * genuine client error doesn't burn retries or fail the whole workflow.
9
- */
10
- export async function fetchUrlImpl(input, deps = defaultDeps) {
11
- const res = await deps.scrape.fetch(input.url, input.headers);
12
- if (isRetryable(res.status)) {
13
- throw new Error(`scrape.fetch ${input.url} failed: ${res.status}`);
14
- }
15
- return res;
16
- }
3
+ import { fetchUrlImpl } from "./fetchCore.js";
4
+ // Impl lives in the task-free ./fetchCore module so sibling scrape tasks can
5
+ // reuse it without registering scrape.fetch. Re-exported for backward compat.
6
+ export { fetchUrlImpl } from "./fetchCore.js";
17
7
  /** Fetch a URL and return status + body. */
18
8
  export const fetchUrl = task({ name: "scrape.fetch", retry: SCRAPE_RETRY }, fetchUrlImpl);
19
9
  //# sourceMappingURL=fetch.js.map
package/dist/fetch.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.js","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAmB,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG1C;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,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;AAED,4CAA4C;AAC5C,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAC1B,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,EAAE,EAC7C,YAAY,CACb,CAAC"}
1
+ {"version":3,"file":"fetch.js","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,6EAA6E;AAC7E,8EAA8E;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,4CAA4C;AAC5C,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAC1B,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,EAAE,EAC7C,YAAY,CACb,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { TaskContext } from "@renderinc/sdk/workflows";
2
+ import { type ScrapeDeps } from "./client.js";
3
+ import type { FetchInput, FetchResult } from "./types.js";
4
+ /**
5
+ * Raw implementation of scrape.fetch. Throws on 429/5xx so the durable retry
6
+ * policy re-runs the fetch; returns other non-2xx (e.g. 404) to the caller so a
7
+ * genuine client error doesn't burn retries or fail the whole workflow.
8
+ *
9
+ * Lives in this task-free module so the other scrape tasks (crawl, links,
10
+ * metadata, …) can reuse the fetch logic without importing fetch.js and
11
+ * registering scrape.fetch as a side effect of their own subpath.
12
+ */
13
+ export declare function fetchUrlImpl(ctx: TaskContext, input: FetchInput, deps?: ScrapeDeps): Promise<FetchResult>;
14
+ //# sourceMappingURL=fetchCore.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,19 @@
1
+ import { isRetryable } from "@render-lab/tasks-core";
2
+ import { defaultDeps } from "./client.js";
3
+ /**
4
+ * Raw implementation of scrape.fetch. Throws on 429/5xx so the durable retry
5
+ * policy re-runs the fetch; returns other non-2xx (e.g. 404) to the caller so a
6
+ * genuine client error doesn't burn retries or fail the whole workflow.
7
+ *
8
+ * Lives in this task-free module so the other scrape tasks (crawl, links,
9
+ * metadata, …) can reuse the fetch logic without importing fetch.js and
10
+ * registering scrape.fetch as a side effect of their own subpath.
11
+ */
12
+ export async function fetchUrlImpl(ctx, input, deps = defaultDeps) {
13
+ const res = await deps.scrape.fetch(input.url, input.headers);
14
+ if (isRetryable(res.status)) {
15
+ throw new Error(`scrape.fetch ${input.url} failed: ${res.status}`);
16
+ }
17
+ return res;
18
+ }
19
+ //# sourceMappingURL=fetchCore.js.map
@@ -0,0 +1 @@
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").TaskFunction<[input: FetchInput, deps?: ScrapeDeps | undefined], LinksResult>;
10
+ export declare const extractPageLinks: import("@renderinc/sdk/workflows").TaskDefinition<[input: FetchInput, deps?: ScrapeDeps | undefined], LinksResult>;
10
11
  //# sourceMappingURL=links.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../src/links.ts"],"names":[],"mappings":"AAGA,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,KAAK,EAAE,UAAU,EACjB,IAAI,GAAE,UAAwB,GAC7B,OAAO,CAAC,WAAW,CAAC,CAGtB;AAED,iDAAiD;AACjD,eAAO,MAAM,gBAAgB,kHAG5B,CAAC"}
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
@@ -1,5 +1,5 @@
1
1
  import { task } from "@renderinc/sdk/workflows";
2
- import { fetchUrlImpl } from "./fetch.js";
2
+ import { fetchUrlImpl } from "./fetchCore.js";
3
3
  import { extractLinks } from "./html.js";
4
4
  import { defaultDeps } from "./client.js";
5
5
  import { SCRAPE_RETRY } from "./retry.js";
@@ -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,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,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,KAAiB,EACjB,OAAmB,WAAW;IAE9B,MAAM,GAAG,GAAG,MAAM,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC5C,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"}
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"}
@@ -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").TaskFunction<[input: FetchInput, deps?: ScrapeDeps | undefined], MetadataResult>;
10
+ export declare const extractPageMetadata: import("@renderinc/sdk/workflows").TaskDefinition<[input: FetchInput, deps?: ScrapeDeps | undefined], MetadataResult>;
10
11
  //# sourceMappingURL=metadata.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":"AAGA,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,KAAK,EAAE,UAAU,EACjB,IAAI,GAAE,UAAwB,GAC7B,OAAO,CAAC,cAAc,CAAC,CAGzB;AAED,gDAAgD;AAChD,eAAO,MAAM,mBAAmB,qHAG/B,CAAC"}
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
@@ -1,5 +1,5 @@
1
1
  import { task } from "@renderinc/sdk/workflows";
2
- import { fetchUrlImpl } from "./fetch.js";
2
+ import { fetchUrlImpl } from "./fetchCore.js";
3
3
  import { extractMetadata } from "./html.js";
4
4
  import { defaultDeps } from "./client.js";
5
5
  import { SCRAPE_RETRY } from "./retry.js";
@@ -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. */
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.js","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,E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G,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").TaskFunction<[input: FetchInput, deps?: ScrapeDeps | undefined], SitemapResult>;
10
+ export declare const sitemap: import("@renderinc/sdk/workflows").TaskDefinition<[input: FetchInput, deps?: ScrapeDeps | undefined], SitemapResult>;
10
11
  //# sourceMappingURL=sitemap.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sitemap.d.ts","sourceRoot":"","sources":["../src/sitemap.ts"],"names":[],"mappings":"AAGA,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,KAAK,EAAE,UAAU,EACjB,IAAI,GAAE,UAAwB,GAC7B,OAAO,CAAC,aAAa,CAAC,CAGxB;AAED,sDAAsD;AACtD,eAAO,MAAM,OAAO,oHAGnB,CAAC"}
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
@@ -1,5 +1,5 @@
1
1
  import { task } from "@renderinc/sdk/workflows";
2
- import { fetchUrlImpl } from "./fetch.js";
2
+ import { fetchUrlImpl } from "./fetchCore.js";
3
3
  import { parseSitemap } from "./html.js";
4
4
  import { defaultDeps } from "./client.js";
5
5
  import { SCRAPE_RETRY } from "./retry.js";
@@ -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. */
@@ -1 +1 @@
1
- {"version":3,"file":"sitemap.js","sourceRoot":"","sources":["../src/sitemap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,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AAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,YAAY,EAAE,EAC/C,WAAW,CACZ,CAAC"}
@@ -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").TaskFunction<[input: FetchInput, deps?: ScrapeDeps | undefined], ToMarkdownResult>;
10
+ export declare const toMarkdown: import("@renderinc/sdk/workflows").TaskDefinition<[input: FetchInput, deps?: ScrapeDeps | undefined], ToMarkdownResult>;
10
11
  //# sourceMappingURL=toMarkdown.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toMarkdown.d.ts","sourceRoot":"","sources":["../src/toMarkdown.ts"],"names":[],"mappings":"AAGA,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,KAAK,EAAE,UAAU,EACjB,IAAI,GAAE,UAAwB,GAC7B,OAAO,CAAC,gBAAgB,CAAC,CAO3B;AAED,uDAAuD;AACvD,eAAO,MAAM,UAAU,uHAGtB,CAAC"}
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"}
@@ -1,5 +1,5 @@
1
1
  import { task } from "@renderinc/sdk/workflows";
2
- import { fetchUrlImpl } from "./fetch.js";
2
+ import { fetchUrlImpl } from "./fetchCore.js";
3
3
  import { extractTitle, htmlToMarkdown } from "./html.js";
4
4
  import { defaultDeps } from "./client.js";
5
5
  import { SCRAPE_RETRY } from "./retry.js";
@@ -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),
@@ -1 +1 @@
1
- {"version":3,"file":"toMarkdown.js","sourceRoot":"","sources":["../src/toMarkdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,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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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,6 +1,6 @@
1
1
  {
2
2
  "name": "@render-lab/tasks-scrape",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Durable web-scrape tasks for Render Workflows: scrape.fetch, scrape.extract.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -9,22 +9,27 @@
9
9
  ".": {
10
10
  "types": "./dist/index.d.ts",
11
11
  "import": "./dist/index.js"
12
+ },
13
+ "./*": {
14
+ "types": "./dist/*.d.ts",
15
+ "import": "./dist/*.js"
12
16
  }
13
17
  },
14
18
  "files": [
15
19
  "dist"
16
20
  ],
17
21
  "peerDependencies": {
18
- "@renderinc/sdk": "0.6.0"
22
+ "@renderinc/sdk": "1.0.0"
19
23
  },
20
24
  "devDependencies": {
21
- "@renderinc/sdk": "0.6.0",
25
+ "@renderinc/sdk": "1.0.0",
22
26
  "@types/node": "^24.0.0",
23
27
  "typescript": "^6.0.0",
24
- "vitest": "^4.1.0"
28
+ "vitest": "^4.1.0",
29
+ "@render-lab/test-utils": "0.1.0"
25
30
  },
26
31
  "dependencies": {
27
- "@render-lab/tasks-core": "0.1.1"
32
+ "@render-lab/tasks-core": "0.2.0"
28
33
  },
29
34
  "scripts": {
30
35
  "build": "tsc -p tsconfig.json",