@attlaz/client 1.110.0 → 1.111.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.
@@ -33,7 +33,14 @@ export declare class ProductOpportunity {
33
33
  productName: string;
34
34
  productImage: string | null;
35
35
  productBrand: string | null;
36
+ productSku: string | null;
36
37
  ownPrice: number;
38
+ /**
39
+ * What the product costs you. **Null means unknown, not free** — the API resolves a stored zero
40
+ * to null where the catalog's source uses zero for "never entered". The same unknown is why
41
+ * `marginPct` can be null.
42
+ */
43
+ costPrice: number | null;
37
44
  /** The product's own currency. Never assume one — see DECISIONS.md (2026-08-08). */
38
45
  currency: string | null;
39
46
  constructor(id: string, catalogProductId: string, type: OpportunityType);
@@ -26,7 +26,14 @@ export class ProductOpportunity {
26
26
  productName = '';
27
27
  productImage = null;
28
28
  productBrand = null;
29
+ productSku = null;
29
30
  ownPrice = 0;
31
+ /**
32
+ * What the product costs you. **Null means unknown, not free** — the API resolves a stored zero
33
+ * to null where the catalog's source uses zero for "never entered". The same unknown is why
34
+ * `marginPct` can be null.
35
+ */
36
+ costPrice = null;
30
37
  /** The product's own currency. Never assume one — see DECISIONS.md (2026-08-08). */
31
38
  currency = null;
32
39
  constructor(id, catalogProductId, type) {
@@ -44,6 +51,8 @@ export class ProductOpportunity {
44
51
  opportunity.computedAt = raw.computed_at ? new Date(raw.computed_at) : null;
45
52
  opportunity.configVersion = Number(raw.config_version ?? 0);
46
53
  opportunity.productName = raw.product_name ?? '';
54
+ opportunity.productSku = raw.product_sku ?? null;
55
+ opportunity.costPrice = raw.cost_price === null || raw.cost_price === undefined ? null : Number(raw.cost_price);
47
56
  opportunity.productImage = raw.product_image ?? null;
48
57
  opportunity.productBrand = raw.product_brand ?? null;
49
58
  opportunity.ownPrice = Number(raw.own_price ?? 0);
@@ -20,14 +20,22 @@ export declare class CrawlJobEndpoint extends Endpoint {
20
20
  create(vendorId: string, isPartial?: boolean): Promise<CrawlJob>;
21
21
  /** Update a crawl job's status ('started', 'finished', 'cancelled'). */
22
22
  updateStatus(crawlJobId: string, status: CrawlJobStatus): Promise<CrawlJob>;
23
+ /**
24
+ * A single vendor's crawl jobs, newest first.
25
+ *
26
+ * Kept alongside the catalog list because `crawl_job` records no catalog: the scraping flow asks
27
+ * "is this vendor already being crawled?" knowing only a vendor. Prefer {@link getByCatalog} for
28
+ * anything user-facing — it is scoped to a catalog the caller can see.
29
+ */
30
+ getByVendor(vendorId: string, pagination?: CursorPagination | null): Promise<CollectionResult<CrawlJob>>;
23
31
  /**
24
32
  * Crawl jobs across every competitor of a catalog (newest first), each with progress
25
- * (`total` / `processed`). Pass `vendorId` to narrow to one competitor.
33
+ * (`total` / `processed`). Pass `vendorIds` to narrow to one or more competitors.
26
34
  *
27
35
  * A crawl job belongs to a vendor, not to a catalog — the API resolves the catalog's competitors
28
- * and returns the jobs of their vendors. A `vendorId` outside this catalog is rejected.
36
+ * and returns the jobs of their vendors. A vendor outside this catalog is rejected.
29
37
  */
30
- getByCatalog(catalogId: CatalogId | string, pagination?: CursorPagination | null, vendorId?: string | null): Promise<CollectionResult<CrawlJob>>;
38
+ getByCatalog(catalogId: CatalogId | string, pagination?: CursorPagination | null, vendorIds?: string[] | null): Promise<CollectionResult<CrawlJob>>;
31
39
  /** The crawl job with this id, or null. */
32
40
  getById(crawlJobId: string): Promise<CrawlJob | null>;
33
41
  /** Register the pages this crawl will process (idempotent server-side). */
@@ -33,18 +33,32 @@ export class CrawlJobEndpoint extends Endpoint {
33
33
  }
34
34
  return job;
35
35
  }
36
+ /**
37
+ * A single vendor's crawl jobs, newest first.
38
+ *
39
+ * Kept alongside the catalog list because `crawl_job` records no catalog: the scraping flow asks
40
+ * "is this vendor already being crawled?" knowing only a vendor. Prefer {@link getByCatalog} for
41
+ * anything user-facing — it is scoped to a catalog the caller can see.
42
+ */
43
+ async getByVendor(vendorId, pagination = null) {
44
+ const queryString = new QueryString(path('/pulse/vendors/:vendorId/crawl-jobs', { vendorId }));
45
+ queryString.addPagination(pagination);
46
+ return await this.requestCollection(queryString, CrawlJob.parse);
47
+ }
36
48
  /**
37
49
  * Crawl jobs across every competitor of a catalog (newest first), each with progress
38
- * (`total` / `processed`). Pass `vendorId` to narrow to one competitor.
50
+ * (`total` / `processed`). Pass `vendorIds` to narrow to one or more competitors.
39
51
  *
40
52
  * A crawl job belongs to a vendor, not to a catalog — the API resolves the catalog's competitors
41
- * and returns the jobs of their vendors. A `vendorId` outside this catalog is rejected.
53
+ * and returns the jobs of their vendors. A vendor outside this catalog is rejected.
42
54
  */
43
- async getByCatalog(catalogId, pagination = null, vendorId = null) {
55
+ async getByCatalog(catalogId, pagination = null, vendorIds = null) {
44
56
  const queryString = new QueryString(path('/pulse/catalogs/:catalogId/crawl-jobs', { catalogId: catalogId.toString() }));
45
57
  queryString.addPagination(pagination);
46
- if (vendorId !== null) {
47
- queryString.set('vendor', vendorId);
58
+ if (vendorIds !== null && vendorIds.length > 0) {
59
+ // Repeated param (`vendor=a&vendor=b`) — QueryString expands arrays, and the API reads it
60
+ // with getOptionalCollection.
61
+ queryString.set('vendor', vendorIds);
48
62
  }
49
63
  return await this.requestCollection(queryString, CrawlJob.parse);
50
64
  }
@@ -10,10 +10,10 @@ import { VendorStatus } from '../Model/VendorStatus.js';
10
10
  */
11
11
  export declare class IndexJobEndpoint extends Endpoint {
12
12
  /**
13
- * Index jobs across every competitor of a catalog, newest first. Pass `vendorId` to narrow to one
14
- * competitor; a vendor outside this catalog is rejected.
13
+ * Index jobs across every competitor of a catalog, newest first. Pass `vendorIds` to narrow to one or more
14
+ * competitors; a vendor outside this catalog is rejected.
15
15
  */
16
- getByCatalog(catalogId: CatalogId | string, pagination?: CursorPagination | null, vendorId?: string | null): Promise<CollectionResult<IndexJob>>;
16
+ getByCatalog(catalogId: CatalogId | string, pagination?: CursorPagination | null, vendorIds?: string[] | null): Promise<CollectionResult<IndexJob>>;
17
17
  /** Queue a re-index of a competitor's products, so later matching sees current data. */
18
18
  requestReindex(catalogId: CatalogId | string, vendorId: string): Promise<void>;
19
19
  /** How fresh a competitor's index and matches are, plus any match job running right now. */
@@ -9,14 +9,16 @@ import { VendorStatus } from '../Model/VendorStatus.js';
9
9
  */
10
10
  export class IndexJobEndpoint extends Endpoint {
11
11
  /**
12
- * Index jobs across every competitor of a catalog, newest first. Pass `vendorId` to narrow to one
13
- * competitor; a vendor outside this catalog is rejected.
12
+ * Index jobs across every competitor of a catalog, newest first. Pass `vendorIds` to narrow to one or more
13
+ * competitors; a vendor outside this catalog is rejected.
14
14
  */
15
- async getByCatalog(catalogId, pagination = null, vendorId = null) {
15
+ async getByCatalog(catalogId, pagination = null, vendorIds = null) {
16
16
  const queryString = new QueryString(path('/pulse/catalogs/:catalogId/index-jobs', { catalogId: catalogId.toString() }));
17
17
  queryString.addPagination(pagination);
18
- if (vendorId !== null) {
19
- queryString.set('vendor', vendorId);
18
+ if (vendorIds !== null && vendorIds.length > 0) {
19
+ // Repeated param (`vendor=a&vendor=b`) — QueryString expands arrays, and the API reads it
20
+ // with getOptionalCollection.
21
+ queryString.set('vendor', vendorIds);
20
22
  }
21
23
  return await this.requestCollection(queryString, IndexJob.parse);
22
24
  }
@@ -3,6 +3,11 @@ import { CursorPagination } from '../../Model/Pagination/CursorPagination.js';
3
3
  import { CollectionResult } from '../../Model/Result/CollectionResult.js';
4
4
  import { Endpoint } from '../../Service/Endpoint.js';
5
5
  import { OpportunityType, ProductOpportunity } from '../Model/ProductOpportunity.js';
6
+ /** Narrowing of the worklist. `brand` is an exact match; `sku` matches a fragment. */
7
+ export type OpportunityFilters = {
8
+ brand?: string;
9
+ sku?: string;
10
+ };
6
11
  /**
7
12
  * The pricing opportunity worklist — `/pulse/catalogs/:catalogId/opportunities`.
8
13
  */
@@ -13,5 +18,5 @@ export declare class OpportunityEndpoint extends Endpoint {
13
18
  * Pass a `type`: the score means something different per type, so an unfiltered read interleaves
14
19
  * four scales into one order. Unfiltered is an overview of what exists, not a ranked worklist.
15
20
  */
16
- getOpportunities(catalogId: CatalogId | string, pagination?: CursorPagination | null, type?: OpportunityType | null): Promise<CollectionResult<ProductOpportunity>>;
21
+ getOpportunities(catalogId: CatalogId | string, pagination?: CursorPagination | null, type?: OpportunityType | null, filters?: OpportunityFilters | null): Promise<CollectionResult<ProductOpportunity>>;
17
22
  }
@@ -12,11 +12,17 @@ export class OpportunityEndpoint extends Endpoint {
12
12
  * Pass a `type`: the score means something different per type, so an unfiltered read interleaves
13
13
  * four scales into one order. Unfiltered is an overview of what exists, not a ranked worklist.
14
14
  */
15
- async getOpportunities(catalogId, pagination = null, type = null) {
15
+ async getOpportunities(catalogId, pagination = null, type = null, filters = null) {
16
16
  const queryString = new QueryString(path('/pulse/catalogs/:catalogId/opportunities', { catalogId: catalogId.toString() }));
17
17
  if (type !== null) {
18
18
  queryString.set('type', type);
19
19
  }
20
+ if (filters?.brand !== undefined) {
21
+ queryString.set('brand', filters.brand);
22
+ }
23
+ if (filters?.sku !== undefined) {
24
+ queryString.set('sku', filters.sku);
25
+ }
20
26
  queryString.addPagination(pagination);
21
27
  return await this.requestCollection(queryString, ProductOpportunity.parse);
22
28
  }
@@ -9,10 +9,10 @@ import { Endpoint } from '../../Service/Endpoint.js';
9
9
  */
10
10
  export declare class ProductMatchJobEndpoint extends Endpoint {
11
11
  /**
12
- * Every match job of a catalog, newest first. Pass `vendorId` to narrow to one of its
13
- * competitors; a vendor outside this catalog is rejected.
12
+ * Every match job of a catalog, newest first. Pass `vendorIds` to narrow to one or more of
13
+ * its competitors; a vendor outside this catalog is rejected.
14
14
  */
15
- getByCatalog(catalogId: CatalogId | string, pagination?: CursorPagination | null, vendorId?: string | null): Promise<CollectionResult<ProductMatchJob>>;
15
+ getByCatalog(catalogId: CatalogId | string, pagination?: CursorPagination | null, vendorIds?: string[] | null): Promise<CollectionResult<ProductMatchJob>>;
16
16
  /** Queue a matching run of the catalog against one competitor. */
17
17
  requestMatching(catalogId: CatalogId | string, vendorId: string): Promise<void>;
18
18
  /** The match job with this id, or null. */
@@ -8,14 +8,16 @@ import { Endpoint } from '../../Service/Endpoint.js';
8
8
  */
9
9
  export class ProductMatchJobEndpoint extends Endpoint {
10
10
  /**
11
- * Every match job of a catalog, newest first. Pass `vendorId` to narrow to one of its
12
- * competitors; a vendor outside this catalog is rejected.
11
+ * Every match job of a catalog, newest first. Pass `vendorIds` to narrow to one or more of
12
+ * its competitors; a vendor outside this catalog is rejected.
13
13
  */
14
- async getByCatalog(catalogId, pagination = null, vendorId = null) {
14
+ async getByCatalog(catalogId, pagination = null, vendorIds = null) {
15
15
  const queryString = new QueryString(path('/pulse/catalogs/:catalogId/match-jobs', { catalogId: catalogId.toString() }));
16
16
  queryString.addPagination(pagination);
17
- if (vendorId !== null) {
18
- queryString.set('vendor', vendorId);
17
+ if (vendorIds !== null && vendorIds.length > 0) {
18
+ // Repeated param (`vendor=a&vendor=b`) — QueryString expands arrays, and the API reads it
19
+ // with getOptionalCollection.
20
+ queryString.set('vendor', vendorIds);
19
21
  }
20
22
  return await this.requestCollection(queryString, ProductMatchJob.parse);
21
23
  }
package/dist/index.d.ts CHANGED
@@ -123,7 +123,7 @@ export { PriceSuggestion, PriceSuggestionStatus } from './MarketPulse/Model/Pric
123
123
  export { PricingRuleData } from './MarketPulse/Model/PricingRuleData.js';
124
124
  export { PricingEndpoint } from './MarketPulse/Service/PricingEndpoint.js';
125
125
  export { ProductOpportunity, OpportunityType } from './MarketPulse/Model/ProductOpportunity.js';
126
- export { OpportunityEndpoint } from './MarketPulse/Service/OpportunityEndpoint.js';
126
+ export { OpportunityEndpoint, OpportunityFilters } from './MarketPulse/Service/OpportunityEndpoint.js';
127
127
  export { ProductGroup, ProductGroupType } from './MarketPulse/Model/ProductGroup.js';
128
128
  export { ProductGroupData } from './MarketPulse/Model/ProductGroupData.js';
129
129
  export { ProductGroupEndpoint } from './MarketPulse/Service/ProductGroupEndpoint.js';
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.109.0";
1
+ export declare const VERSION = "1.110.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "1.109.0";
1
+ export const VERSION = "1.110.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@attlaz/client",
3
- "version": "1.110.0",
3
+ "version": "1.111.0",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",