@instruments/materialgraph 0.19.0 → 0.21.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/attribution-types.d.ts +51 -0
- package/attribution-types.js +13 -0
- package/brand-most-sampled-types.d.ts +33 -0
- package/brand-most-sampled-types.js +1 -0
- package/by-colour-types.d.ts +9 -0
- package/catalogue-client.d.ts +70 -0
- package/catalogue-client.js +44 -0
- package/colours-client.d.ts +8 -3
- package/colours-client.js +8 -0
- package/compare-types.d.ts +89 -0
- package/compare-types.js +1 -0
- package/correction-types.d.ts +88 -0
- package/correction-types.js +1 -0
- package/exploration-types.d.ts +1 -0
- package/http-transport.d.ts +2 -0
- package/http-transport.js +6 -1
- package/identify-types.d.ts +72 -0
- package/identify-types.js +7 -0
- package/index.d.ts +7 -0
- package/match-stream-types.d.ts +13 -0
- package/match-types.d.ts +10 -0
- package/material-block-types.d.ts +4 -0
- package/operations.d.ts +1 -1
- package/operations.js +42 -2
- package/package.json +12 -1
- package/palette-completion-types.d.ts +115 -0
- package/palette-completion-types.js +1 -0
- package/samplize-colorvec.d.ts +70 -0
- package/samplize-colorvec.js +167 -0
- package/search-card-types.d.ts +55 -0
- package/search-card-types.js +1 -0
- package/search-response-types.d.ts +11 -0
- package/search-response-types.js +1 -0
- package/substitute-types.d.ts +28 -1
- package/types.d.ts +32 -44
- package/webmcp.d.ts +17 -0
- package/webmcp.generated.d.ts +2 -0
- package/webmcp.generated.js +90 -0
- package/webmcp.js +1 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result attribution (MG-1131) — joining an outcome back to the ranking that
|
|
3
|
+
* produced it.
|
|
4
|
+
*
|
|
5
|
+
* When someone orders a sample days after a search, a list of SKUs cannot say
|
|
6
|
+
* which response returned it or on what basis it was ranked. Store
|
|
7
|
+
* {@link SearchResultItem.resultId} next to the order row and
|
|
8
|
+
* {@link ResponseAttribution} beside the search, and both questions become a
|
|
9
|
+
* join in your own warehouse.
|
|
10
|
+
*
|
|
11
|
+
* MaterialGraph keeps no ledger of these ids. What you store IS the record.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* The ranking basis, in one vocabulary across both ranked routes.
|
|
15
|
+
*
|
|
16
|
+
* The first five values are `search()`'s `mode` verbatim, and there
|
|
17
|
+
* `attribution.basis === mode` always. `"match"` is what `match()` reports;
|
|
18
|
+
* that route has no `mode`, so this is the only field its outcomes can be
|
|
19
|
+
* grouped by.
|
|
20
|
+
*/
|
|
21
|
+
export type AttributionBasis = "image" | "colour" | "text" | "lexical" | "entity-browse" | "match";
|
|
22
|
+
/**
|
|
23
|
+
* Envelope-level attribution receipt, on every successful ranked response.
|
|
24
|
+
*
|
|
25
|
+
* Store this beside the search and each result's `resultId` beside the outcome
|
|
26
|
+
* (an order, a save, a click), and "which sample was ordered off which ranking,
|
|
27
|
+
* on what basis" becomes a join in your own warehouse.
|
|
28
|
+
*
|
|
29
|
+
* A `resultId` is `<responseId>:<rank>`, rank being 1-based within the response
|
|
30
|
+
* that returned it — unique across pages, because each page is its own
|
|
31
|
+
* response. On the Match stream lane it also carries the surface id, so a hit
|
|
32
|
+
* sent twice (on its `surface` frame and again inside `complete`) keeps one key.
|
|
33
|
+
*
|
|
34
|
+
* Both ids are OPAQUE: store them verbatim, never parse them. Group on
|
|
35
|
+
* `responseId` and `basis`.
|
|
36
|
+
*
|
|
37
|
+
* Both fields are optional in the SDK types for one reason only: a server
|
|
38
|
+
* predating MG-1131 does not send them. Every current response does.
|
|
39
|
+
*/
|
|
40
|
+
export interface ResponseAttribution {
|
|
41
|
+
/**
|
|
42
|
+
* This response's stable id — the same value as the `X-Request-Id` header.
|
|
43
|
+
* Opaque: store it verbatim, never parse it. Group your stored outcomes by
|
|
44
|
+
* this field to recover the response that produced them.
|
|
45
|
+
*/
|
|
46
|
+
responseId: string;
|
|
47
|
+
/** How this ranking was produced. The field to group outcomes by. */
|
|
48
|
+
basis: AttributionBasis;
|
|
49
|
+
/** ISO-8601 timestamp of when the response was assembled. */
|
|
50
|
+
issuedAt: string;
|
|
51
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result attribution (MG-1131) — joining an outcome back to the ranking that
|
|
3
|
+
* produced it.
|
|
4
|
+
*
|
|
5
|
+
* When someone orders a sample days after a search, a list of SKUs cannot say
|
|
6
|
+
* which response returned it or on what basis it was ranked. Store
|
|
7
|
+
* {@link SearchResultItem.resultId} next to the order row and
|
|
8
|
+
* {@link ResponseAttribution} beside the search, and both questions become a
|
|
9
|
+
* join in your own warehouse.
|
|
10
|
+
*
|
|
11
|
+
* MaterialGraph keeps no ledger of these ids. What you store IS the record.
|
|
12
|
+
*/
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { CandidateReadCard } from "./exploration-types.js";
|
|
2
|
+
export interface BrandMostSampledResponse {
|
|
3
|
+
data: {
|
|
4
|
+
brand: {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
};
|
|
8
|
+
status: "ready" | "unavailable";
|
|
9
|
+
metric: "sample_order_lines";
|
|
10
|
+
provenance: {
|
|
11
|
+
source: "material_bank_order_history";
|
|
12
|
+
signal: "sampled";
|
|
13
|
+
sessionId: string;
|
|
14
|
+
window: "trailing_36mo";
|
|
15
|
+
windowStart: string;
|
|
16
|
+
windowEnd: string;
|
|
17
|
+
} | null;
|
|
18
|
+
products: Array<{
|
|
19
|
+
rank: number;
|
|
20
|
+
sampleOrderLines: number;
|
|
21
|
+
representativeVariantSampleOrderLines: number;
|
|
22
|
+
card: CandidateReadCard & {
|
|
23
|
+
category: string | null;
|
|
24
|
+
};
|
|
25
|
+
}>;
|
|
26
|
+
};
|
|
27
|
+
meta: {
|
|
28
|
+
operationId: "brands.most_sampled";
|
|
29
|
+
requestId: string;
|
|
30
|
+
};
|
|
31
|
+
links: Record<string, never>;
|
|
32
|
+
warnings: never[];
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/by-colour-types.d.ts
CHANGED
|
@@ -99,6 +99,15 @@ export interface ColourFamilyGate {
|
|
|
99
99
|
* once the page is cut to `limit`; this is the gate's own cost.
|
|
100
100
|
*/
|
|
101
101
|
dropped: number;
|
|
102
|
+
/**
|
|
103
|
+
* Rows dropped a SECOND time, after the page was hydrated with the brand's
|
|
104
|
+
* declared `colour_hex`. A paint's chip photograph and its published hex are
|
|
105
|
+
* different colours and can fall in different families, so the page is
|
|
106
|
+
* re-gated on the hex it reports — every `hex` you receive belongs to the
|
|
107
|
+
* family you asked for. Absent means hydration moved nothing across a
|
|
108
|
+
* boundary.
|
|
109
|
+
*/
|
|
110
|
+
droppedOnPublishedHex?: number;
|
|
102
111
|
}
|
|
103
112
|
/** Receipt for the hard category gate and its treatment of unknown typing. */
|
|
104
113
|
export interface ColourCategoryGate {
|
package/catalogue-client.d.ts
CHANGED
|
@@ -1,11 +1,81 @@
|
|
|
1
|
+
import type { BrandMostSampledResponse } from "./brand-most-sampled-types.js";
|
|
1
2
|
import type { CatalogDocumentList, CatalogPageListResult, CatalogProductReferenceReadResult, CatalogueChannelCollectionsResponse, CatalogueCollectionsOptions, CatalogueDocumentAccessResult, CataloguePageRepresentationReadResult, CatalogueReferenceBatchResponse } from "./catalogue-types.js";
|
|
3
|
+
import type { CompareInput, CompareResponse } from "./compare-types.js";
|
|
4
|
+
import type { CreateCorrectionInput, CorrectionResponse, CorrectionsListResponse } from "./correction-types.js";
|
|
2
5
|
import type { HttpTransport } from "./http-transport.js";
|
|
3
6
|
import type { VariantId } from "./identifiers.js";
|
|
7
|
+
import type { IdentifySelectedPageInput, IdentifySelectedPageResult } from "./identify-types.js";
|
|
4
8
|
import type { SamplizeCatalogueOptions, SamplizeCataloguePage } from "./samplize-catalogue-types.js";
|
|
9
|
+
import type { SamplizeColorVecCache } from "./samplize-colorvec.js";
|
|
5
10
|
/** Catalogue publication operations inherited by the public SDK client. */
|
|
6
11
|
export declare class CatalogueClient {
|
|
7
12
|
#private;
|
|
8
13
|
protected constructor(transport: HttpTransport);
|
|
14
|
+
/** Brand products ranked by observed Material Bank sample-order lines, with window provenance. */
|
|
15
|
+
brandMostSampled(brandId: string, options?: {
|
|
16
|
+
limit?: number;
|
|
17
|
+
}, signal?: AbortSignal): Promise<BrandMostSampledResponse>;
|
|
18
|
+
/** Compare canonical Variants without searching or ranking them. */
|
|
19
|
+
compare(input: CompareInput, signal?: AbortSignal): Promise<CompareResponse>;
|
|
20
|
+
/** Submit confirmed caller-authored review work; never changes accepted truth. */
|
|
21
|
+
createCorrection(input: CreateCorrectionInput, options: {
|
|
22
|
+
idempotencyKey: string;
|
|
23
|
+
signal?: AbortSignal;
|
|
24
|
+
}): Promise<CorrectionResponse>;
|
|
25
|
+
getCorrection(correctionId: string, signal?: AbortSignal): Promise<CorrectionResponse>;
|
|
26
|
+
listCorrections(input?: {
|
|
27
|
+
cursor?: string;
|
|
28
|
+
limit?: number;
|
|
29
|
+
}, signal?: AbortSignal): Promise<CorrectionsListResponse>;
|
|
30
|
+
/** Identify the canonical graph subject for one explicitly selected page. */
|
|
31
|
+
identify(input: IdentifySelectedPageInput, signal?: AbortSignal): Promise<IdentifySelectedPageResult>;
|
|
32
|
+
/** Complete producer-owned vectors and classifications for portable colour matching. */
|
|
33
|
+
samplizeColorVecCache(sourceVersion: string, signal?: AbortSignal): Promise<SamplizeColorVecCache>;
|
|
34
|
+
/** MG-owned full-catalogue facets and directional colour refinement before page limiting. */
|
|
35
|
+
samplizeCatalogueSearch(input: {
|
|
36
|
+
palette?: Array<{
|
|
37
|
+
hex: string;
|
|
38
|
+
proportion: number;
|
|
39
|
+
}>;
|
|
40
|
+
query?: string;
|
|
41
|
+
reference?: string;
|
|
42
|
+
direction?: "similar" | "lighter" | "darker" | "muted";
|
|
43
|
+
lightnessMin?: number;
|
|
44
|
+
lightnessMax?: number;
|
|
45
|
+
temperatureMin?: number;
|
|
46
|
+
temperatureMax?: number;
|
|
47
|
+
family?: string[];
|
|
48
|
+
lightness?: string[];
|
|
49
|
+
intensity?: string[];
|
|
50
|
+
brand?: string[];
|
|
51
|
+
sourceVersion: string;
|
|
52
|
+
limit?: number;
|
|
53
|
+
}, signal?: AbortSignal): Promise<{
|
|
54
|
+
target?: {
|
|
55
|
+
ref: string;
|
|
56
|
+
hex: string;
|
|
57
|
+
name?: string;
|
|
58
|
+
source: string;
|
|
59
|
+
confidence?: number;
|
|
60
|
+
};
|
|
61
|
+
embeddingVersion?: string;
|
|
62
|
+
rankingVersion?: string;
|
|
63
|
+
dictionaryVersion?: string;
|
|
64
|
+
eligibleCount?: number;
|
|
65
|
+
groups?: Array<{
|
|
66
|
+
hex: string;
|
|
67
|
+
proportion: number;
|
|
68
|
+
quota: number;
|
|
69
|
+
ids: string[];
|
|
70
|
+
shortfall: number;
|
|
71
|
+
}>;
|
|
72
|
+
ids: string[];
|
|
73
|
+
limited: boolean;
|
|
74
|
+
sourceVersion: string;
|
|
75
|
+
counts: Record<string, Record<string, number>>;
|
|
76
|
+
countBasis: string;
|
|
77
|
+
basis: string;
|
|
78
|
+
}>;
|
|
9
79
|
/** Complete version-pinned Samplize paint corpus; stock never limits eligibility. */
|
|
10
80
|
samplizeCatalogue(options?: SamplizeCatalogueOptions, signal?: AbortSignal): Promise<SamplizeCataloguePage>;
|
|
11
81
|
/**
|
package/catalogue-client.js
CHANGED
|
@@ -5,6 +5,50 @@ export class CatalogueClient {
|
|
|
5
5
|
constructor(transport) {
|
|
6
6
|
this.#transport = transport;
|
|
7
7
|
}
|
|
8
|
+
/** Brand products ranked by observed Material Bank sample-order lines, with window provenance. */
|
|
9
|
+
brandMostSampled(brandId, options = {}, signal) {
|
|
10
|
+
return this.#transport.requestJson(resolveOperation("brands.most_sampled"), { query: { brandId, ...options }, signal });
|
|
11
|
+
}
|
|
12
|
+
/** Compare canonical Variants without searching or ranking them. */
|
|
13
|
+
compare(input, signal) {
|
|
14
|
+
return this.#transport.requestJson(resolveOperation("retrieval.compare"), {
|
|
15
|
+
body: input,
|
|
16
|
+
signal,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
/** Submit confirmed caller-authored review work; never changes accepted truth. */
|
|
20
|
+
createCorrection(input, options) {
|
|
21
|
+
if (!/^[\x21-\x7e]{1,200}$/.test(options.idempotencyKey))
|
|
22
|
+
throw new Error("A valid Idempotency-Key is required for Correction submission.");
|
|
23
|
+
return this.#transport.requestJson(resolveOperation("corrections.create"), {
|
|
24
|
+
body: input,
|
|
25
|
+
...options,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
getCorrection(correctionId, signal) {
|
|
29
|
+
return this.#transport.requestJson(resolveOperation("corrections.get"), {
|
|
30
|
+
pathParams: { correctionId },
|
|
31
|
+
signal,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
listCorrections(input = {}, signal) {
|
|
35
|
+
return this.#transport.requestJson(resolveOperation("corrections.list"), {
|
|
36
|
+
query: input,
|
|
37
|
+
signal,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/** Identify the canonical graph subject for one explicitly selected page. */
|
|
41
|
+
identify(input, signal) {
|
|
42
|
+
return this.#transport.requestJson(resolveOperation("retrieval.identify"), { body: input, signal });
|
|
43
|
+
}
|
|
44
|
+
/** Complete producer-owned vectors and classifications for portable colour matching. */
|
|
45
|
+
samplizeColorVecCache(sourceVersion, signal) {
|
|
46
|
+
return this.#transport.requestJson(resolveOperation("samplize_colorvec_cache"), { query: { sourceVersion }, signal });
|
|
47
|
+
}
|
|
48
|
+
/** MG-owned full-catalogue facets and directional colour refinement before page limiting. */
|
|
49
|
+
samplizeCatalogueSearch(input, signal) {
|
|
50
|
+
return this.#transport.requestJson(resolveOperation("samplize_catalogue_search"), { body: input, signal });
|
|
51
|
+
}
|
|
8
52
|
/** Complete version-pinned Samplize paint corpus; stock never limits eligibility. */
|
|
9
53
|
samplizeCatalogue(options = {}, signal) {
|
|
10
54
|
return this.#transport.requestJson(resolveOperation("samplize_catalogue_products"), { query: { ...options }, signal });
|
package/colours-client.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { CategoryColourProfilesResponse, ColourProfilesParams, ColourStatsParams, ColourStatsResponse } from "./colour-aggregate-types.js";
|
|
2
|
+
import type { QueryParams } from "./http-transport.js";
|
|
3
|
+
import type { SdkOperationId } from "./operations.js";
|
|
1
4
|
/**
|
|
2
5
|
* The colour surface, namespaced as `mg.colours` — the aggregate reads
|
|
3
6
|
* (`stats`, `profiles`) plus MULTI-COLOUR search (`palette`, `gradient`).
|
|
@@ -32,9 +35,7 @@
|
|
|
32
35
|
* FROM PRODUCT IMAGERY, not declared by the manufacturer. Report visual
|
|
33
36
|
* likeness, never a stated colour specification.
|
|
34
37
|
*/
|
|
35
|
-
import type {
|
|
36
|
-
import type { QueryParams } from "./http-transport.js";
|
|
37
|
-
import type { SdkOperationId } from "./operations.js";
|
|
38
|
+
import type { PaletteCompleteInput, PaletteCompleteResponse, PaletteDiscoverInput, PaletteDiscoverResponse } from "./palette-completion-types.js";
|
|
38
39
|
import type { SearchGradientInput, SearchGradientResponse, SearchPaletteInput, SearchPaletteResponse } from "./palette-search-types.js";
|
|
39
40
|
/** The client's own request primitives, handed down so this file owns no transport. */
|
|
40
41
|
export interface ColoursTransport {
|
|
@@ -44,6 +45,10 @@ export interface ColoursTransport {
|
|
|
44
45
|
export declare class ColoursClient {
|
|
45
46
|
#private;
|
|
46
47
|
constructor(transport: ColoursTransport);
|
|
48
|
+
/** Complete exact retained colors against a shared published interior reference. No Cart mutation. */
|
|
49
|
+
complete(input: PaletteCompleteInput, signal?: AbortSignal): Promise<PaletteCompleteResponse>;
|
|
50
|
+
/** Browse diverse published interior compositions against a version-pinned eligible catalogue. */
|
|
51
|
+
discover(input: PaletteDiscoverInput, signal?: AbortSignal): Promise<PaletteDiscoverResponse>;
|
|
47
52
|
/**
|
|
48
53
|
* THE QUESTION: "what colours does this CATEGORY come in?" — the representative
|
|
49
54
|
* palette of 1–8 categories in ONE call (GET `/api/v1/colours/profiles`).
|
package/colours-client.js
CHANGED
|
@@ -3,6 +3,14 @@ export class ColoursClient {
|
|
|
3
3
|
constructor(transport) {
|
|
4
4
|
this.#transport = transport;
|
|
5
5
|
}
|
|
6
|
+
/** Complete exact retained colors against a shared published interior reference. No Cart mutation. */
|
|
7
|
+
complete(input, signal) {
|
|
8
|
+
return this.#transport.post("complete_interior_palette", input, signal);
|
|
9
|
+
}
|
|
10
|
+
/** Browse diverse published interior compositions against a version-pinned eligible catalogue. */
|
|
11
|
+
discover(input, signal) {
|
|
12
|
+
return this.#transport.get("discover_interior_palettes", { ...input }, signal);
|
|
13
|
+
}
|
|
6
14
|
/**
|
|
7
15
|
* THE QUESTION: "what colours does this CATEGORY come in?" — the representative
|
|
8
16
|
* palette of 1–8 categories in ONE call (GET `/api/v1/colours/profiles`).
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
export interface CompareInput {
|
|
2
|
+
variantIds: string[];
|
|
3
|
+
selection?: {
|
|
4
|
+
kind: "blocks";
|
|
5
|
+
blockIds: string[];
|
|
6
|
+
} | {
|
|
7
|
+
kind: "attributes";
|
|
8
|
+
attributeIds: string[];
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
type Availability = "available" | "discontinued" | "superseded" | "unknown";
|
|
12
|
+
type ClaimScope = "variant" | "product" | "brand";
|
|
13
|
+
export interface CompareTarget {
|
|
14
|
+
variantId: string;
|
|
15
|
+
version: string;
|
|
16
|
+
freshness: {
|
|
17
|
+
oldestAt: string | null;
|
|
18
|
+
newestAt: string | null;
|
|
19
|
+
};
|
|
20
|
+
identity: {
|
|
21
|
+
variantId: string;
|
|
22
|
+
variantName: string | null;
|
|
23
|
+
brand: string;
|
|
24
|
+
brandSlug: string;
|
|
25
|
+
product: string;
|
|
26
|
+
productId: string;
|
|
27
|
+
colourName: string | null;
|
|
28
|
+
category: string | null;
|
|
29
|
+
categoryPath: string[];
|
|
30
|
+
imageUrl: string | null;
|
|
31
|
+
installationImageUrl: string | null;
|
|
32
|
+
dominantHex: string | null;
|
|
33
|
+
siblingCount: number;
|
|
34
|
+
};
|
|
35
|
+
availability: {
|
|
36
|
+
state: Availability;
|
|
37
|
+
label: string | null;
|
|
38
|
+
supersededBy: {
|
|
39
|
+
variantId: string;
|
|
40
|
+
brandSlug: string;
|
|
41
|
+
productId: string;
|
|
42
|
+
brand: string;
|
|
43
|
+
product: string;
|
|
44
|
+
variant: string;
|
|
45
|
+
color: string | null;
|
|
46
|
+
availability: Availability;
|
|
47
|
+
} | null;
|
|
48
|
+
};
|
|
49
|
+
sampleability: boolean | null;
|
|
50
|
+
}
|
|
51
|
+
export interface CompareCell {
|
|
52
|
+
variantId: string;
|
|
53
|
+
state: "known" | "unknown" | "conflicting" | "inapplicable";
|
|
54
|
+
recordState: "stated" | "conflicting" | "stale" | "unknown" | "missing" | "not_applicable" | "not_evaluated";
|
|
55
|
+
value: unknown;
|
|
56
|
+
unit: string | null;
|
|
57
|
+
verification: "verified" | "unverified" | "unbacked";
|
|
58
|
+
confidence: number | null;
|
|
59
|
+
sourceBasis: string | null;
|
|
60
|
+
sourceRef: string | null;
|
|
61
|
+
freshnessAt: string | null;
|
|
62
|
+
claimScope: ClaimScope | null;
|
|
63
|
+
competingClaims: {
|
|
64
|
+
scope: ClaimScope;
|
|
65
|
+
value: unknown;
|
|
66
|
+
sourceRef: string | null;
|
|
67
|
+
}[];
|
|
68
|
+
}
|
|
69
|
+
export interface CompareResult {
|
|
70
|
+
targets: CompareTarget[];
|
|
71
|
+
rows: {
|
|
72
|
+
blockId: string;
|
|
73
|
+
blockName: string;
|
|
74
|
+
attributeId: string;
|
|
75
|
+
label: string;
|
|
76
|
+
outcome: "same" | "different" | "incomplete" | "indeterminate" | "not_applicable";
|
|
77
|
+
cells: CompareCell[];
|
|
78
|
+
}[];
|
|
79
|
+
}
|
|
80
|
+
export interface CompareResponse {
|
|
81
|
+
data: CompareResult;
|
|
82
|
+
meta: {
|
|
83
|
+
operationId: "retrieval.compare";
|
|
84
|
+
requestId: string;
|
|
85
|
+
};
|
|
86
|
+
links: Record<string, never>;
|
|
87
|
+
warnings: never[];
|
|
88
|
+
}
|
|
89
|
+
export {};
|
package/compare-types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export type CorrectionJson = null | boolean | number | string | CorrectionJson[] | {
|
|
2
|
+
[key: string]: CorrectionJson;
|
|
3
|
+
};
|
|
4
|
+
export type CorrectionSubject = {
|
|
5
|
+
kind: "brand" | "product" | "variant";
|
|
6
|
+
id: string;
|
|
7
|
+
};
|
|
8
|
+
export type CorrectionTarget = {
|
|
9
|
+
kind: "identity";
|
|
10
|
+
subject: CorrectionSubject;
|
|
11
|
+
} | {
|
|
12
|
+
kind: "attribute";
|
|
13
|
+
subject: CorrectionSubject;
|
|
14
|
+
blockId: string;
|
|
15
|
+
attributeId: string;
|
|
16
|
+
} | {
|
|
17
|
+
kind: "relationship";
|
|
18
|
+
subject: CorrectionSubject;
|
|
19
|
+
relationship: string;
|
|
20
|
+
relatedSubject: CorrectionSubject;
|
|
21
|
+
} | {
|
|
22
|
+
kind: "source_interpretation";
|
|
23
|
+
sourceMaterialId: string;
|
|
24
|
+
subject?: CorrectionSubject;
|
|
25
|
+
} | {
|
|
26
|
+
kind: "missing_record";
|
|
27
|
+
url: string;
|
|
28
|
+
};
|
|
29
|
+
/** Caller-supplied evidence is not an independently verified graph reading. */
|
|
30
|
+
export interface CorrectionEvidence {
|
|
31
|
+
state: "known" | "unknown" | "conflicting" | "not_applicable";
|
|
32
|
+
value?: CorrectionJson;
|
|
33
|
+
sourceUrl?: string;
|
|
34
|
+
note?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface CreateCorrectionInput {
|
|
37
|
+
target: CorrectionTarget;
|
|
38
|
+
pageEvidence: CorrectionEvidence;
|
|
39
|
+
graphEvidence: CorrectionEvidence;
|
|
40
|
+
proposedChange: CorrectionJson;
|
|
41
|
+
rationale: string;
|
|
42
|
+
}
|
|
43
|
+
export interface Correction {
|
|
44
|
+
id: string;
|
|
45
|
+
submission: CreateCorrectionInput;
|
|
46
|
+
status: "submitted" | "in_review" | "resolved" | "withdrawn";
|
|
47
|
+
resolution: "substantiated" | "not_substantiated" | "duplicate" | "superseded" | "cannot_determine" | null;
|
|
48
|
+
createdAt: string;
|
|
49
|
+
updatedAt: string;
|
|
50
|
+
acceptedTruthChanged: false;
|
|
51
|
+
}
|
|
52
|
+
export interface CorrectionResponse {
|
|
53
|
+
data: Correction;
|
|
54
|
+
meta: {
|
|
55
|
+
operationId: "corrections.create";
|
|
56
|
+
requestId: string;
|
|
57
|
+
idempotency: {
|
|
58
|
+
replayed: boolean;
|
|
59
|
+
};
|
|
60
|
+
} | {
|
|
61
|
+
operationId: "corrections.get";
|
|
62
|
+
requestId: string;
|
|
63
|
+
};
|
|
64
|
+
links: {
|
|
65
|
+
self: string;
|
|
66
|
+
};
|
|
67
|
+
warnings: never[];
|
|
68
|
+
}
|
|
69
|
+
export interface CorrectionsListResponse {
|
|
70
|
+
data: Correction[];
|
|
71
|
+
meta: {
|
|
72
|
+
operationId: "corrections.list";
|
|
73
|
+
requestId: string;
|
|
74
|
+
page: {
|
|
75
|
+
returned: number;
|
|
76
|
+
total: {
|
|
77
|
+
value: null;
|
|
78
|
+
basis: "unavailable";
|
|
79
|
+
};
|
|
80
|
+
nextCursor: string | null;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
links: {
|
|
84
|
+
self: string;
|
|
85
|
+
next: string | null;
|
|
86
|
+
};
|
|
87
|
+
warnings: never[];
|
|
88
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/exploration-types.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export interface GraphOperatorEvidence {
|
|
|
18
18
|
export interface CandidateReadInput {
|
|
19
19
|
operator: "looks_like";
|
|
20
20
|
corpusScope?: CorpusScope;
|
|
21
|
+
/** Return up to 24 ranked candidates (default 8), from one bounded retrieval. */
|
|
21
22
|
limit?: number;
|
|
22
23
|
excludeVariantIds?: VariantId[];
|
|
23
24
|
}
|
package/http-transport.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ import { type SdkOperation } from "./operations.js";
|
|
|
11
11
|
export type QueryValue = string | number | boolean | undefined | null | Array<string | number | boolean>;
|
|
12
12
|
export type QueryParams = Record<string, QueryValue>;
|
|
13
13
|
export interface RequestOptions {
|
|
14
|
+
/** Required by state-changing operations that support safe retries. */
|
|
15
|
+
idempotencyKey?: string;
|
|
14
16
|
query?: QueryParams;
|
|
15
17
|
body?: unknown;
|
|
16
18
|
signal?: AbortSignal;
|
package/http-transport.js
CHANGED
|
@@ -211,7 +211,12 @@ export class HttpTransport {
|
|
|
211
211
|
const { parsed } = await this.send({
|
|
212
212
|
method: sdkOperation.method,
|
|
213
213
|
url,
|
|
214
|
-
headers: this.authHeaders(
|
|
214
|
+
headers: this.authHeaders({
|
|
215
|
+
...(hasBody ? { "Content-Type": "application/json" } : {}),
|
|
216
|
+
...(options.idempotencyKey
|
|
217
|
+
? { "Idempotency-Key": options.idempotencyKey }
|
|
218
|
+
: {}),
|
|
219
|
+
}),
|
|
215
220
|
body: hasBody ? JSON.stringify(options.body) : undefined,
|
|
216
221
|
signal: options.signal,
|
|
217
222
|
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public wire types for `POST /api/v1/identify`.
|
|
3
|
+
*
|
|
4
|
+
* These intentionally mirror the domain-owned Zod contract rather than
|
|
5
|
+
* importing it: the published SDK must carry no workspace package dependency.
|
|
6
|
+
*/
|
|
7
|
+
export interface IdentifySelectedPageInput {
|
|
8
|
+
url: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
selectedText?: string;
|
|
11
|
+
productLabels?: string[];
|
|
12
|
+
brandLabels?: string[];
|
|
13
|
+
/** Manufacturer code visibly supplied by the selected page. */
|
|
14
|
+
manufacturerCode?: string;
|
|
15
|
+
imageUrls?: string[];
|
|
16
|
+
colourHexes?: string[];
|
|
17
|
+
}
|
|
18
|
+
export interface IdentifySelectedPageSubject {
|
|
19
|
+
kind: "variant" | "product" | "brand";
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
brand?: {
|
|
23
|
+
id: string;
|
|
24
|
+
name: string;
|
|
25
|
+
slug: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export interface IdentifySelectedPageEvidence {
|
|
29
|
+
kind: "manufacturer-url" | "brand-homepage" | "visible-identity" | "visual" | "colour";
|
|
30
|
+
url?: string;
|
|
31
|
+
detail: string;
|
|
32
|
+
}
|
|
33
|
+
interface IdentifySelectedPageDataBase {
|
|
34
|
+
receipt: {
|
|
35
|
+
submittedUrl: string;
|
|
36
|
+
normalizedUrl: string;
|
|
37
|
+
normalizationSteps: string[];
|
|
38
|
+
};
|
|
39
|
+
evidence: IdentifySelectedPageEvidence[];
|
|
40
|
+
}
|
|
41
|
+
export type IdentifySelectedPageData = (IdentifySelectedPageDataBase & {
|
|
42
|
+
outcome: "identified";
|
|
43
|
+
rung: "lookup" | "disambiguate";
|
|
44
|
+
subject: IdentifySelectedPageSubject & {
|
|
45
|
+
kind: "variant";
|
|
46
|
+
};
|
|
47
|
+
}) | (IdentifySelectedPageDataBase & {
|
|
48
|
+
outcome: "placed";
|
|
49
|
+
rung: "lookup";
|
|
50
|
+
subject: IdentifySelectedPageSubject & {
|
|
51
|
+
kind: "product" | "brand";
|
|
52
|
+
};
|
|
53
|
+
}) | (IdentifySelectedPageDataBase & {
|
|
54
|
+
outcome: "ambiguous";
|
|
55
|
+
rung: "lookup" | "disambiguate" | "match" | "color";
|
|
56
|
+
candidates: IdentifySelectedPageSubject[];
|
|
57
|
+
truncated: boolean;
|
|
58
|
+
}) | (IdentifySelectedPageDataBase & {
|
|
59
|
+
outcome: "unresolved";
|
|
60
|
+
rung?: "match" | "color";
|
|
61
|
+
});
|
|
62
|
+
/** The canonical callable-operation envelope returned by `identify()`. */
|
|
63
|
+
export interface IdentifySelectedPageResult {
|
|
64
|
+
data: IdentifySelectedPageData;
|
|
65
|
+
meta: {
|
|
66
|
+
operationId: "retrieval.identify";
|
|
67
|
+
requestId: string;
|
|
68
|
+
};
|
|
69
|
+
links: Record<string, never>;
|
|
70
|
+
warnings: [];
|
|
71
|
+
}
|
|
72
|
+
export {};
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { MaterialGraphClient, DEFAULT_BASE_URL, MAX_BATCH_IDS, } from "./client.js";
|
|
2
|
+
export type { CompareInput, CompareTarget, CompareCell, CompareResult, CompareResponse, } from "./compare-types.js";
|
|
3
|
+
export type { CorrectionJson, CorrectionSubject, CorrectionTarget, CorrectionEvidence, CreateCorrectionInput, Correction, CorrectionResponse, CorrectionsListResponse, } from "./correction-types.js";
|
|
2
4
|
export type { MaterialGraphClientOptions, BrowseNamespace, ExplorationNamespace, SourceMaterialCommentsNamespace, } from "./client.js";
|
|
3
5
|
export { MATERIALGRAPH_API_VERSION, SDK_OPERATIONS } from "./operations.js";
|
|
4
6
|
export type { SdkOperation, SdkOperationId } from "./operations.js";
|
|
@@ -19,7 +21,9 @@ export { MATERIALGRAPH_PROBLEM_EXTENSIONS, MaterialGraphError, } from "./errors.
|
|
|
19
21
|
export type { MaterialGraphErrorInit, MaterialGraphErrorKind, MaterialGraphRequestMetadata, ProblemDetail, RateLimit, SanitizedErrorValue, SanitizedIssue, SimpleErrorBody, } from "./errors.js";
|
|
20
22
|
export type * from "./types.js";
|
|
21
23
|
export type * from "./search-collapse-types.js";
|
|
24
|
+
export type * from "./search-card-types.js";
|
|
22
25
|
export type * from "./match-types.js";
|
|
26
|
+
export type * from "./identify-types.js";
|
|
23
27
|
export type * from "./browse-types.js";
|
|
24
28
|
export type * from "./catalogue-types.js";
|
|
25
29
|
export type * from "./by-colour-types.js";
|
|
@@ -45,7 +49,10 @@ export type * from "./schedule-reference-types.js";
|
|
|
45
49
|
export type * from "./substitute-types.js";
|
|
46
50
|
export type * from "./search-refinement-types.js";
|
|
47
51
|
export type * from "./search-window-types.js";
|
|
52
|
+
export type * from "./attribution-types.js";
|
|
48
53
|
export { CERTIFICATION_PROGRAMME_ATTRIBUTE_ID } from "./spec-types.js";
|
|
49
54
|
export type * from "./spec-types.js";
|
|
50
55
|
export { certificationProgramme, certificationProgrammeCriterion, hasSpec, specCriterion, specRangeCriterion, specTerm, } from "./specifications.js";
|
|
51
56
|
export type { SamplizePublicationSource, SamplizeLrvObservation, SamplizeDemand, SamplizeCollectionMembership, SamplizeCatalogueOptions, SamplizeCataloguePage, SamplizeCatalogueProduct, SamplizeHexObservation, } from "./samplize-catalogue-types.js";
|
|
57
|
+
export type { PaletteCompleteInput, PaletteCompleteResponse, PaletteDiscoverInput, PaletteDiscoverResponse, } from "./palette-completion-types.js";
|
|
58
|
+
export type { BrandMostSampledResponse } from "./brand-most-sampled-types.js";
|
package/match-stream-types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ResponseAttribution } from "./attribution-types.js";
|
|
1
2
|
import type { MatchCategoryInference, MatchColourReading } from "./match-types.js";
|
|
2
3
|
/**
|
|
3
4
|
* The Material Match PROGRESS-STREAM contracts — the wire vocabulary of
|
|
@@ -179,6 +180,18 @@ export type MatchSenseCheckVerdict = (typeof MATCH_SENSE_CHECK_VERDICTS)[number]
|
|
|
179
180
|
export declare const MATCH_OUTCOMES: readonly ["matched", "no_surfaces"];
|
|
180
181
|
export type MatchOutcome = (typeof MATCH_OUTCOMES)[number];
|
|
181
182
|
export interface MatchWorkflowResult {
|
|
183
|
+
/**
|
|
184
|
+
* Result attribution (MG-1131) — `responseId` (the same value as the run's
|
|
185
|
+
* `X-Request-Id` header), `basis: "match"`, and `issuedAt`. Every item in
|
|
186
|
+
* `results` and in each `surfaces[].results` carries a matching `resultId`.
|
|
187
|
+
*
|
|
188
|
+
* A surface's hits arrive twice — on its own `surface` frame and again here —
|
|
189
|
+
* and both times with the SAME `resultId`, so a consumer that stored the
|
|
190
|
+
* first recognises the second rather than double-counting it.
|
|
191
|
+
*
|
|
192
|
+
* ABSENT only from a response produced by a server predating MG-1131.
|
|
193
|
+
*/
|
|
194
|
+
attribution?: ResponseAttribution;
|
|
182
195
|
imageType: MatchImageType;
|
|
183
196
|
/** How the run ended. Absent means `matched`. */
|
|
184
197
|
outcome?: MatchOutcome;
|