@attlaz/client 1.86.0 → 1.87.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.
@@ -12,4 +12,13 @@ export declare class CrawlJobEndpoint extends Endpoint {
12
12
  updateStatus(crawlJobId: string, status: CrawlJobStatus): Promise<CrawlJob>;
13
13
  /** The crawl job with this id, or null. */
14
14
  getById(crawlJobId: string): Promise<CrawlJob | null>;
15
+ /** Register the pages this crawl will process (idempotent server-side). */
16
+ registerPages(crawlJobId: string, urls: string[]): Promise<void>;
17
+ /** Mark pages as crawled (fetched). */
18
+ markPagesCrawled(crawlJobId: string, urls: string[]): Promise<void>;
19
+ /** Mark pages as parsed (terminal). The crawl auto-finishes once every page is terminal. */
20
+ markPagesParsed(crawlJobId: string, urls: string[]): Promise<void>;
21
+ /** Mark pages as failed (terminal, e.g. blocked/unfetchable). */
22
+ markPagesFailed(crawlJobId: string, urls: string[]): Promise<void>;
23
+ private postUrls;
15
24
  }
@@ -29,4 +29,26 @@ export class CrawlJobEndpoint extends Endpoint {
29
29
  const result = await this.requestObject('/pulse/crawl-jobs/' + crawlJobId, null, CrawlJob.parse, 'GET');
30
30
  return result.getData();
31
31
  }
32
+ /** Register the pages this crawl will process (idempotent server-side). */
33
+ async registerPages(crawlJobId, urls) {
34
+ await this.postUrls(crawlJobId, '/pages', urls);
35
+ }
36
+ /** Mark pages as crawled (fetched). */
37
+ async markPagesCrawled(crawlJobId, urls) {
38
+ await this.postUrls(crawlJobId, '/pages/crawled', urls);
39
+ }
40
+ /** Mark pages as parsed (terminal). The crawl auto-finishes once every page is terminal. */
41
+ async markPagesParsed(crawlJobId, urls) {
42
+ await this.postUrls(crawlJobId, '/pages/parsed', urls);
43
+ }
44
+ /** Mark pages as failed (terminal, e.g. blocked/unfetchable). */
45
+ async markPagesFailed(crawlJobId, urls) {
46
+ await this.postUrls(crawlJobId, '/pages/failed', urls);
47
+ }
48
+ async postUrls(crawlJobId, path, urls) {
49
+ if (urls.length === 0) {
50
+ return;
51
+ }
52
+ await this.requestObject('/pulse/crawl-jobs/' + crawlJobId + path, { urls }, (raw) => raw, 'POST');
53
+ }
32
54
  }
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.85.0";
1
+ export declare const VERSION = "1.86.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "1.85.0";
1
+ export const VERSION = "1.86.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@attlaz/client",
3
- "version": "1.86.0",
3
+ "version": "1.87.0",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",