@attlaz/client 1.87.0 → 1.88.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,6 +12,9 @@ export declare class CrawlJob {
12
12
  requestedAt: Date | null;
13
13
  startedAt: Date | null;
14
14
  finishedAt: Date | null;
15
+ /** Progress (populated by list endpoints): total pages and how many have been processed. */
16
+ total: number;
17
+ processed: number;
15
18
  constructor(id: string, vendorId: string);
16
19
  static parse(raw: ApiRecord): CrawlJob;
17
20
  }
@@ -10,6 +10,9 @@ export class CrawlJob {
10
10
  requestedAt;
11
11
  startedAt;
12
12
  finishedAt;
13
+ /** Progress (populated by list endpoints): total pages and how many have been processed. */
14
+ total = 0;
15
+ processed = 0;
13
16
  constructor(id, vendorId) {
14
17
  this.id = id;
15
18
  this.vendorId = vendorId;
@@ -24,6 +27,8 @@ export class CrawlJob {
24
27
  job.requestedAt = raw.requested_at ? new Date(raw.requested_at) : null;
25
28
  job.startedAt = raw.started_at ? new Date(raw.started_at) : null;
26
29
  job.finishedAt = raw.finished_at ? new Date(raw.finished_at) : null;
30
+ job.total = Number(raw.total ?? 0);
31
+ job.processed = Number(raw.processed ?? 0);
27
32
  return job;
28
33
  }
29
34
  }
@@ -10,6 +10,8 @@ export declare class CrawlJobEndpoint extends Endpoint {
10
10
  create(vendorId: string): Promise<CrawlJob>;
11
11
  /** Update a crawl job's status ('started', 'finished', 'cancelled'). */
12
12
  updateStatus(crawlJobId: string, status: CrawlJobStatus): Promise<CrawlJob>;
13
+ /** A vendor's crawl jobs (newest first), each with progress (`total` / `processed`). */
14
+ getByVendor(vendorId: string): Promise<CrawlJob[]>;
13
15
  /** The crawl job with this id, or null. */
14
16
  getById(crawlJobId: string): Promise<CrawlJob | null>;
15
17
  /** Register the pages this crawl will process (idempotent server-side). */
@@ -24,6 +24,11 @@ export class CrawlJobEndpoint extends Endpoint {
24
24
  }
25
25
  return job;
26
26
  }
27
+ /** A vendor's crawl jobs (newest first), each with progress (`total` / `processed`). */
28
+ async getByVendor(vendorId) {
29
+ const result = await this.requestCollection('/pulse/vendors/' + vendorId + '/crawl-jobs', CrawlJob.parse);
30
+ return result.getData();
31
+ }
27
32
  /** The crawl job with this id, or null. */
28
33
  async getById(crawlJobId) {
29
34
  const result = await this.requestObject('/pulse/crawl-jobs/' + crawlJobId, null, CrawlJob.parse, 'GET');
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.86.0";
1
+ export declare const VERSION = "1.87.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "1.86.0";
1
+ export const VERSION = "1.87.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@attlaz/client",
3
- "version": "1.87.0",
3
+ "version": "1.88.0",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",