@attlaz/client 1.137.0 → 1.138.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/MarketPulse/Model/CrawlJob.d.ts +7 -0
- package/dist/MarketPulse/Model/CrawlJob.js +6 -0
- package/dist/MarketPulse/Service/CrawlJobEndpoint.d.ts +7 -3
- package/dist/MarketPulse/Service/CrawlJobEndpoint.js +7 -3
- package/dist/index.d.ts +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ApiRecord } from '../../Model/ApiRecord.js';
|
|
2
2
|
export type CrawlJobStatus = 'pending' | 'started' | 'cancelled' | 'stopped' | 'finished';
|
|
3
|
+
/** Why a crawl ended `stopped`. Mirrors apps-lib's CrawlJobStopReason. */
|
|
4
|
+
export type CrawlJobStopReason = 'no_currency' | 'no_parser' | 'empty_listing' | 'all_pages_failed' | 'no_pages_registered' | 'never_dispatched' | 'already_running' | 'run_failed';
|
|
3
5
|
/**
|
|
4
6
|
* A Market Pulse crawl job: one run of scraping a vendor. Its lifecycle (pending → started →
|
|
5
7
|
* finished) drives the vendor's "last scraped" timestamp (`finishedAt`) and, on finish, triggers
|
|
@@ -27,6 +29,11 @@ export declare class CrawlJob {
|
|
|
27
29
|
total: number;
|
|
28
30
|
processed: number;
|
|
29
31
|
failed: number;
|
|
32
|
+
/**
|
|
33
|
+
* Why a `stopped` crawl stopped (populated by list endpoints). Null for any other status, and for a
|
|
34
|
+
* crawl stopped before reasons were recorded or by a writer that gave none.
|
|
35
|
+
*/
|
|
36
|
+
stopReason: CrawlJobStopReason | null;
|
|
30
37
|
constructor(id: string, vendorId: string);
|
|
31
38
|
static parse(raw: ApiRecord): CrawlJob;
|
|
32
39
|
}
|
|
@@ -25,6 +25,11 @@ export class CrawlJob {
|
|
|
25
25
|
total = 0;
|
|
26
26
|
processed = 0;
|
|
27
27
|
failed = 0;
|
|
28
|
+
/**
|
|
29
|
+
* Why a `stopped` crawl stopped (populated by list endpoints). Null for any other status, and for a
|
|
30
|
+
* crawl stopped before reasons were recorded or by a writer that gave none.
|
|
31
|
+
*/
|
|
32
|
+
stopReason = null;
|
|
28
33
|
constructor(id, vendorId) {
|
|
29
34
|
this.id = id;
|
|
30
35
|
this.vendorId = vendorId;
|
|
@@ -43,6 +48,7 @@ export class CrawlJob {
|
|
|
43
48
|
job.total = Number(raw.total ?? 0);
|
|
44
49
|
job.processed = Number(raw.processed ?? 0);
|
|
45
50
|
job.failed = Number(raw.failed ?? 0);
|
|
51
|
+
job.stopReason = typeof raw.stop_reason === 'string' ? raw.stop_reason : null;
|
|
46
52
|
return job;
|
|
47
53
|
}
|
|
48
54
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CatalogId } from '../../Catalog/Model/CatalogId.js';
|
|
2
2
|
import { CursorPagination } from '../../Model/Pagination/CursorPagination.js';
|
|
3
|
-
import { CrawlJob, CrawlJobStatus } from '../Model/CrawlJob.js';
|
|
3
|
+
import { CrawlJob, CrawlJobStatus, CrawlJobStopReason } from '../Model/CrawlJob.js';
|
|
4
4
|
import { CrawlJobPage } from '../Model/CrawlJobPage.js';
|
|
5
5
|
import { CollectionResult } from '../../Model/Result/CollectionResult.js';
|
|
6
6
|
import { Endpoint } from '../../Service/Endpoint.js';
|
|
@@ -18,8 +18,12 @@ export declare class CrawlJobEndpoint extends Endpoint {
|
|
|
18
18
|
* silence about them is not evidence they are gone.
|
|
19
19
|
*/
|
|
20
20
|
create(vendorId: string, isPartial?: boolean): Promise<CrawlJob>;
|
|
21
|
-
/**
|
|
22
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Update a crawl job's status ('started', 'finished', 'cancelled', 'stopped').
|
|
23
|
+
*
|
|
24
|
+
* @param reason Why it stopped; accepted with 'stopped' only, and shown with the crawl.
|
|
25
|
+
*/
|
|
26
|
+
updateStatus(crawlJobId: string, status: CrawlJobStatus, reason?: CrawlJobStopReason | null): Promise<CrawlJob>;
|
|
23
27
|
/**
|
|
24
28
|
* A single vendor's crawl jobs, newest first.
|
|
25
29
|
*
|
|
@@ -24,9 +24,13 @@ export class CrawlJobEndpoint extends Endpoint {
|
|
|
24
24
|
}
|
|
25
25
|
return job;
|
|
26
26
|
}
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Update a crawl job's status ('started', 'finished', 'cancelled', 'stopped').
|
|
29
|
+
*
|
|
30
|
+
* @param reason Why it stopped; accepted with 'stopped' only, and shown with the crawl.
|
|
31
|
+
*/
|
|
32
|
+
async updateStatus(crawlJobId, status, reason = null) {
|
|
33
|
+
const result = await this.requestObject(path('/pulse/crawl-jobs/:crawlJobId', { crawlJobId }), reason === null ? { status } : { status, reason }, CrawlJob.parse, 'PATCH');
|
|
30
34
|
const job = result.getData();
|
|
31
35
|
if (job === null) {
|
|
32
36
|
throw new Error('Unable to update crawl job: empty response');
|
package/dist/index.d.ts
CHANGED
|
@@ -88,7 +88,7 @@ export { StorageType } from './Model/Storage/StorageType.js';
|
|
|
88
88
|
export { VendorProduct } from './MarketPulse/Model/VendorProduct.js';
|
|
89
89
|
export { StockStatus, parseStockStatus, stockStatusFromBoolean } from './MarketPulse/Model/StockStatus.js';
|
|
90
90
|
export { VendorProductEndpoint } from './MarketPulse/Service/VendorProductEndpoint.js';
|
|
91
|
-
export { CrawlJob, CrawlJobStatus } from './MarketPulse/Model/CrawlJob.js';
|
|
91
|
+
export { CrawlJob, CrawlJobStatus, CrawlJobStopReason } from './MarketPulse/Model/CrawlJob.js';
|
|
92
92
|
export { CrawlJobPage, CrawlJobPageStatus } from './MarketPulse/Model/CrawlJobPage.js';
|
|
93
93
|
export { CrawlJobEndpoint } from './MarketPulse/Service/CrawlJobEndpoint.js';
|
|
94
94
|
export { VendorProductPriceHistoryEntry } from './MarketPulse/Model/VendorProductPriceHistoryEntry.js';
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "1.
|
|
1
|
+
export declare const VERSION = "1.137.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "1.
|
|
1
|
+
export const VERSION = "1.137.0";
|