@instruments/materialgraph 0.24.0 → 0.26.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/association-types.d.ts +20 -20
- package/associations-client.d.ts +4 -4
- package/associations-client.js +3 -10
- package/attribution-types.d.ts +3 -3
- package/brand-most-sampled-types.d.ts +4 -4
- package/brand-types.d.ts +6 -6
- package/brands-client.d.ts +4 -4
- package/brands-client.js +9 -13
- package/browse-types.d.ts +8 -8
- package/by-colour-types.d.ts +18 -18
- package/by-spec-types.d.ts +14 -14
- package/catalog-discovery-types.d.ts +14 -14
- package/catalogue-client.d.ts +4 -4
- package/catalogue-client.js +38 -37
- package/catalogue-types.d.ts +4 -4
- package/citation-types.d.ts +4 -4
- package/client-browse.d.ts +4 -4
- package/client-browse.js +24 -25
- package/client-config.d.ts +2 -2
- package/client-exploration.d.ts +3 -3
- package/client-exploration.js +4 -6
- package/client-source-material-comments.d.ts +4 -4
- package/client-source-material-comments.js +4 -38
- package/client-vocabulary.d.ts +8 -8
- package/client-vocabulary.js +20 -30
- package/client.d.ts +11 -45
- package/client.js +143 -188
- package/codes-client.d.ts +2 -2
- package/codes-client.js +8 -8
- package/codes-types.d.ts +34 -34
- package/colour-aggregate-types.d.ts +24 -24
- package/colours-client.d.ts +2 -2
- package/colours-client.js +15 -15
- package/compare-types.d.ts +10 -10
- package/composition-client.d.ts +3 -3
- package/composition-client.js +8 -7
- package/composition-types.d.ts +12 -12
- package/coordinate-client.d.ts +2 -2
- package/coordinate-client.js +1 -13
- package/corpus-scope-types.d.ts +3 -3
- package/corpus-scope-types.js +1 -25
- package/correction-types.d.ts +10 -10
- package/demand-batch-types.d.ts +18 -18
- package/demand-types.d.ts +24 -24
- package/errors.d.ts +12 -12
- package/errors.js +53 -52
- package/exploration-types.d.ts +29 -22
- package/fan-deck-types.d.ts +6 -6
- package/http-transport.d.ts +13 -21
- package/http-transport.js +31 -28
- package/identify-types.d.ts +10 -10
- package/index.d.ts +0 -6
- package/index.js +0 -2
- package/match-rejection-types.d.ts +6 -6
- package/match-stream-types.d.ts +32 -32
- package/match-stream.d.ts +2 -2
- package/match-stream.js +55 -41
- package/match-types.d.ts +8 -8
- package/material-asset-types.d.ts +26 -26
- package/material-block-types.d.ts +6 -6
- package/material-query-plan-types.d.ts +26 -26
- package/material-resources-client.d.ts +5 -5
- package/material-resources-client.js +10 -20
- package/material-types.d.ts +12 -12
- package/ndjson.js +16 -8
- package/operations.d.ts +6 -6
- package/operations.js +9 -39
- package/package.json +2 -2
- package/palette-completion-types.d.ts +22 -22
- package/palette-search-types.d.ts +28 -28
- package/query-understanding-types.d.ts +43 -36
- package/render-assets-types.d.ts +8 -8
- package/resolve-client.d.ts +2 -2
- package/resolve-client.js +4 -6
- package/resolve-colour-types.d.ts +22 -6
- package/resolve-types.d.ts +10 -10
- package/run-types.d.ts +70 -70
- package/runs.d.ts +13 -26
- package/runs.js +77 -89
- package/samplize-catalogue-types.d.ts +18 -18
- package/samplize-colorvec.d.ts +20 -20
- package/samplize-colorvec.js +66 -42
- package/schema-resource-types.d.ts +38 -38
- package/schema-resource-types.js +5 -5
- package/search-card-types.d.ts +14 -5
- package/search-collapse-types.d.ts +4 -4
- package/search-mood-types.d.ts +2 -2
- package/search-refinement-types.d.ts +8 -8
- package/search-request-types.d.ts +6 -6
- package/search-response-receipt-types.d.ts +135 -34
- package/search-response-types.d.ts +2 -2
- package/search-result-validation.d.ts +3 -3
- package/search-result-validation.js +53 -36
- package/search-window-types.d.ts +2 -2
- package/slot-pool-types.d.ts +20 -20
- package/source-material-validation.d.ts +3 -3
- package/source-material-validation.js +35 -39
- package/spec-facet-types.d.ts +10 -10
- package/spec-types.d.ts +6 -6
- package/specifications.d.ts +9 -25
- package/specifications.js +15 -21
- package/sse.d.ts +2 -2
- package/sse.js +32 -16
- package/substitute-types.d.ts +22 -22
- package/suggest-types.d.ts +7 -7
- package/suggest-types.js +3 -3
- package/taxonomy-coverage-types.d.ts +8 -8
- package/types.d.ts +119 -119
- package/validation.d.ts +26 -26
- package/validation.js +97 -92
- package/webmcp.d.ts +2 -2
- package/webmcp.generated.js +94 -87
- package/project-types.d.ts +0 -79
- package/project-types.js +0 -9
- package/projects.d.ts +0 -13
- package/projects.js +0 -46
- package/run-events.d.ts +0 -106
- package/run-events.js +0 -32
- package/schedule-reference-types.d.ts +0 -46
- package/schedule-reference-types.js +0 -1
- package/schedule-references-client.d.ts +0 -14
- package/schedule-references-client.js +0 -26
- package/schedule-types.d.ts +0 -261
- package/schedule-types.js +0 -1
package/exploration-types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CorpusScope, CorpusScopeReceipt } from "./corpus-scope-types.js";
|
|
2
2
|
import type { VariantId } from "./identifiers.js";
|
|
3
3
|
export type GraphOperator = "colourways" | "same_category" | "still_listed" | "looks_like" | "same_colour" | "pairs_with" | "often_specified_with" | "substitutes_for" | "more_durable" | "outdoor_suitable" | "lower_cost" | "more_sustainable";
|
|
4
|
-
export
|
|
4
|
+
export type GraphOperatorAvailability = {
|
|
5
5
|
operator: GraphOperator;
|
|
6
6
|
operatorClass: "identity" | "perceptual" | "relational" | "spec";
|
|
7
7
|
label: string;
|
|
@@ -10,30 +10,30 @@ export interface GraphOperatorAvailability {
|
|
|
10
10
|
discoverable: boolean;
|
|
11
11
|
discoveryBasis: string;
|
|
12
12
|
count?: number;
|
|
13
|
-
}
|
|
14
|
-
export
|
|
13
|
+
};
|
|
14
|
+
export type GraphOperatorEvidence = {
|
|
15
15
|
variantId: VariantId;
|
|
16
16
|
operators: GraphOperatorAvailability[];
|
|
17
|
-
}
|
|
18
|
-
export
|
|
17
|
+
};
|
|
18
|
+
export type CandidateReadInput = {
|
|
19
19
|
operator: "looks_like";
|
|
20
20
|
corpusScope?: CorpusScope;
|
|
21
21
|
/** Return up to 24 ranked candidates (default 8), from one bounded retrieval. */
|
|
22
22
|
limit?: number;
|
|
23
23
|
excludeVariantIds?: VariantId[];
|
|
24
|
-
}
|
|
25
|
-
export
|
|
24
|
+
};
|
|
25
|
+
export type CandidateReadImage = {
|
|
26
26
|
url: string;
|
|
27
27
|
source: "r2" | "origin";
|
|
28
28
|
/** Null means this image has not been analysed for a uniform light background. */
|
|
29
29
|
isIsolated: boolean | null;
|
|
30
|
-
}
|
|
31
|
-
export
|
|
30
|
+
};
|
|
31
|
+
export type CandidateReadPaletteSwatch = {
|
|
32
32
|
hex: string;
|
|
33
33
|
proportion: number;
|
|
34
34
|
name?: string | null;
|
|
35
|
-
}
|
|
36
|
-
export
|
|
35
|
+
};
|
|
36
|
+
export type CandidateReadCard = {
|
|
37
37
|
variantId: VariantId;
|
|
38
38
|
productId: string;
|
|
39
39
|
brandSlug: string;
|
|
@@ -44,27 +44,27 @@ export interface CandidateReadCard {
|
|
|
44
44
|
color: string | null;
|
|
45
45
|
image: CandidateReadImage | null;
|
|
46
46
|
palette: CandidateReadPaletteSwatch[];
|
|
47
|
-
}
|
|
48
|
-
export
|
|
47
|
+
};
|
|
48
|
+
export type CandidateRankEvidence = {
|
|
49
49
|
rank: number;
|
|
50
50
|
distance: number;
|
|
51
51
|
similarity: number;
|
|
52
52
|
basis: "active_main_image_embedding";
|
|
53
53
|
provenanceGrade: "measured";
|
|
54
54
|
displayImageMatchedEvidence: boolean | null;
|
|
55
|
-
}
|
|
56
|
-
export
|
|
55
|
+
};
|
|
56
|
+
export type CandidateReadCandidate = {
|
|
57
57
|
evidence: CandidateRankEvidence;
|
|
58
58
|
reason: string;
|
|
59
|
-
}
|
|
60
|
-
export
|
|
59
|
+
} & CandidateReadCard;
|
|
60
|
+
export type CandidateSeedEvidence = {
|
|
61
61
|
evidenceImageSha256: string;
|
|
62
62
|
displayImageSha256: string | null;
|
|
63
63
|
basis: "active_main_image_embedding";
|
|
64
64
|
provenanceGrade: "measured";
|
|
65
65
|
displayImageMatchedEvidence: boolean | null;
|
|
66
|
-
}
|
|
67
|
-
export
|
|
66
|
+
};
|
|
67
|
+
export type CandidateReadReceipt = {
|
|
68
68
|
operator: "looks_like";
|
|
69
69
|
corpusScope: CorpusScopeReceipt | null;
|
|
70
70
|
requestedLimit: number;
|
|
@@ -77,6 +77,13 @@ export interface CandidateReadReceipt {
|
|
|
77
77
|
dedupe: {
|
|
78
78
|
retrieved: number;
|
|
79
79
|
removed: number;
|
|
80
|
+
/**
|
|
81
|
+
* How many of `removed` went because an earlier row showed the SAME
|
|
82
|
+
* PICTURE, counted apart from the id rules (MG-1917). Distinct products
|
|
83
|
+
* routinely share one photograph, so an id-only collapse returned the same
|
|
84
|
+
* image several times on one page.
|
|
85
|
+
*/
|
|
86
|
+
removedBySharedImage: number;
|
|
80
87
|
truncated: number;
|
|
81
88
|
projectionMisses: number;
|
|
82
89
|
};
|
|
@@ -87,11 +94,11 @@ export interface CandidateReadReceipt {
|
|
|
87
94
|
projectionMs: number;
|
|
88
95
|
completeMs: number;
|
|
89
96
|
};
|
|
90
|
-
}
|
|
91
|
-
|
|
97
|
+
};
|
|
98
|
+
type CandidateReadResponseBase = {
|
|
92
99
|
seed: CandidateReadCard;
|
|
93
100
|
receipt: CandidateReadReceipt;
|
|
94
|
-
}
|
|
101
|
+
};
|
|
95
102
|
export type CandidateReadResponse = (CandidateReadResponseBase & {
|
|
96
103
|
status: "ready";
|
|
97
104
|
seedEvidence: CandidateSeedEvidence;
|
package/fan-deck-types.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* while holding one page of each. So the response carries the brand, and
|
|
7
7
|
* `truncatedAt` appears only if a range ever exceeds the server's ceiling.
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export type FanDeckSwatch = {
|
|
10
10
|
/** Opaque token. Never parse or construct one. */
|
|
11
11
|
variantId: string;
|
|
12
12
|
brand: string;
|
|
@@ -19,13 +19,13 @@ export interface FanDeckSwatch {
|
|
|
19
19
|
/** OKLab L, 0–1. The sort key within a family: light to dark. */
|
|
20
20
|
lightness: number;
|
|
21
21
|
imageUrl: string | null;
|
|
22
|
-
}
|
|
23
|
-
export
|
|
22
|
+
};
|
|
23
|
+
export type FanDeckFamily = {
|
|
24
24
|
family: string;
|
|
25
25
|
/** Count over the WHOLE range, computed before any truncation. */
|
|
26
26
|
count: number;
|
|
27
|
-
}
|
|
28
|
-
export
|
|
27
|
+
};
|
|
28
|
+
export type BrandFanDeck = {
|
|
29
29
|
/**
|
|
30
30
|
* The brand SLUGS the deck resolved to — round-trippable identifiers, not
|
|
31
31
|
* display names. The maker's name as it should be shown is on every swatch.
|
|
@@ -39,4 +39,4 @@ export interface BrandFanDeck {
|
|
|
39
39
|
* deck is complete — absent is not zero.
|
|
40
40
|
*/
|
|
41
41
|
truncatedAt?: number;
|
|
42
|
-
}
|
|
42
|
+
};
|
package/http-transport.d.ts
CHANGED
|
@@ -1,48 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* one error-mapping path — so the JSON read surface (`client.ts`), the multipart
|
|
5
|
-
* upload, the SSE stream (`runs.ts`), and the NDJSON Match stream
|
|
6
|
-
* (`match-stream.ts`) all fail identically. Retry-free by design; a single
|
|
7
|
-
* failure surfaces as one {@link MaterialGraphError}.
|
|
8
|
-
*/
|
|
9
|
-
import { type RateLimit } from "./errors.js";
|
|
10
|
-
import { type SdkOperation } from "./operations.js";
|
|
11
|
-
export type QueryValue = string | number | boolean | undefined | null | Array<string | number | boolean>;
|
|
1
|
+
import type { RateLimit } from "./errors.js";
|
|
2
|
+
import type { SdkOperation } from "./operations.js";
|
|
3
|
+
export type QueryValue = string | number | boolean | undefined | null | (string | number | boolean)[];
|
|
12
4
|
export type QueryParams = Record<string, QueryValue>;
|
|
13
|
-
export
|
|
5
|
+
export type RequestOptions = {
|
|
14
6
|
/** Required by state-changing operations that support safe retries. */
|
|
15
7
|
idempotencyKey?: string;
|
|
16
8
|
query?: QueryParams;
|
|
17
9
|
body?: unknown;
|
|
18
10
|
signal?: AbortSignal;
|
|
19
11
|
pathParams?: Readonly<Record<string, string>>;
|
|
20
|
-
}
|
|
21
|
-
export
|
|
12
|
+
};
|
|
13
|
+
export type StreamRequestOptions = {
|
|
22
14
|
/** The streaming media type to negotiate (`text/event-stream`, `application/x-ndjson`). */
|
|
23
15
|
accept: string;
|
|
24
16
|
/** Names this stream in the "returned no body" diagnostic, e.g. `"match stream"`. */
|
|
25
17
|
subject: string;
|
|
26
|
-
}
|
|
18
|
+
} & RequestOptions;
|
|
27
19
|
/** A read, status-checked HTTP response with its parsed body. */
|
|
28
|
-
export
|
|
20
|
+
export type SentResponse = {
|
|
29
21
|
response: Response;
|
|
30
22
|
text: string;
|
|
31
23
|
parsed: unknown;
|
|
32
|
-
}
|
|
33
|
-
|
|
24
|
+
};
|
|
25
|
+
type SendInput = {
|
|
34
26
|
method: string;
|
|
35
27
|
url: string;
|
|
36
28
|
headers: Record<string, string>;
|
|
37
29
|
/** The only bodies the SDK sends: a JSON string or a multipart `FormData`. */
|
|
38
30
|
body?: string | FormData;
|
|
39
31
|
signal?: AbortSignal;
|
|
40
|
-
}
|
|
41
|
-
export
|
|
32
|
+
};
|
|
33
|
+
export type HttpTransportOptions = {
|
|
42
34
|
apiKey: string;
|
|
43
35
|
baseUrl: string;
|
|
44
36
|
fetch: typeof fetch;
|
|
45
|
-
}
|
|
37
|
+
};
|
|
46
38
|
export declare class HttpTransport {
|
|
47
39
|
#private;
|
|
48
40
|
readonly baseUrl: string;
|
package/http-transport.js
CHANGED
|
@@ -8,13 +8,14 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { MaterialGraphError } from "./errors.js";
|
|
10
10
|
import { operationPath } from "./operations.js";
|
|
11
|
-
|
|
12
|
-
if (value === null)
|
|
11
|
+
const parseIntOrNull = (value) => {
|
|
12
|
+
if (value === null) {
|
|
13
13
|
return null;
|
|
14
|
+
}
|
|
14
15
|
const parsed = Number.parseInt(value, 10);
|
|
15
16
|
return Number.isNaN(parsed) ? null : parsed;
|
|
16
|
-
}
|
|
17
|
-
|
|
17
|
+
};
|
|
18
|
+
const parseRateLimit = (headers) => {
|
|
18
19
|
const limit = parseIntOrNull(headers.get("x-ratelimit-limit"));
|
|
19
20
|
const remaining = parseIntOrNull(headers.get("x-ratelimit-remaining"));
|
|
20
21
|
const reset = parseIntOrNull(headers.get("x-ratelimit-reset"));
|
|
@@ -26,7 +27,7 @@ function parseRateLimit(headers) {
|
|
|
26
27
|
return null;
|
|
27
28
|
}
|
|
28
29
|
return { limit, remaining, reset, retryAfter };
|
|
29
|
-
}
|
|
30
|
+
};
|
|
30
31
|
export class HttpTransport {
|
|
31
32
|
baseUrl;
|
|
32
33
|
apiKey;
|
|
@@ -34,7 +35,7 @@ export class HttpTransport {
|
|
|
34
35
|
#lastRateLimit = null;
|
|
35
36
|
constructor(options) {
|
|
36
37
|
this.apiKey = options.apiKey;
|
|
37
|
-
this.baseUrl = options.baseUrl.replace(
|
|
38
|
+
this.baseUrl = options.baseUrl.replace(/\/+$/u, "");
|
|
38
39
|
this.fetch = options.fetch;
|
|
39
40
|
}
|
|
40
41
|
get lastRateLimit() {
|
|
@@ -43,8 +44,8 @@ export class HttpTransport {
|
|
|
43
44
|
/** The bearer + JSON `Accept` headers, plus any per-request additions. */
|
|
44
45
|
authHeaders(extra) {
|
|
45
46
|
return {
|
|
46
|
-
Authorization: `Bearer ${this.apiKey}`,
|
|
47
47
|
Accept: "application/json",
|
|
48
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
48
49
|
...extra,
|
|
49
50
|
};
|
|
50
51
|
}
|
|
@@ -52,12 +53,14 @@ export class HttpTransport {
|
|
|
52
53
|
const url = new URL(`${this.baseUrl}${path}`);
|
|
53
54
|
if (query) {
|
|
54
55
|
for (const [key, value] of Object.entries(query)) {
|
|
55
|
-
if (value === undefined || value === null)
|
|
56
|
+
if (value === undefined || value === null) {
|
|
56
57
|
continue;
|
|
58
|
+
}
|
|
57
59
|
if (Array.isArray(value)) {
|
|
58
60
|
for (const item of value) {
|
|
59
|
-
if (item !== undefined && item !== null)
|
|
61
|
+
if (item !== undefined && item !== null) {
|
|
60
62
|
url.searchParams.append(key, String(item));
|
|
63
|
+
}
|
|
61
64
|
}
|
|
62
65
|
}
|
|
63
66
|
else {
|
|
@@ -83,17 +86,17 @@ export class HttpTransport {
|
|
|
83
86
|
let response;
|
|
84
87
|
try {
|
|
85
88
|
response = await this.fetch(input.url, {
|
|
86
|
-
method: input.method,
|
|
87
|
-
headers: input.headers,
|
|
88
89
|
body: input.body,
|
|
90
|
+
headers: input.headers,
|
|
91
|
+
method: input.method,
|
|
89
92
|
signal: input.signal,
|
|
90
93
|
});
|
|
91
94
|
}
|
|
92
95
|
catch (cause) {
|
|
93
96
|
throw MaterialGraphError.fromTransport({
|
|
94
97
|
...metadata,
|
|
95
|
-
cause,
|
|
96
98
|
callerSignal: input.signal,
|
|
99
|
+
cause,
|
|
97
100
|
});
|
|
98
101
|
}
|
|
99
102
|
const rateLimit = parseRateLimit(response.headers);
|
|
@@ -105,8 +108,8 @@ export class HttpTransport {
|
|
|
105
108
|
catch (cause) {
|
|
106
109
|
throw MaterialGraphError.fromTransport({
|
|
107
110
|
...metadata,
|
|
108
|
-
cause,
|
|
109
111
|
callerSignal: input.signal,
|
|
112
|
+
cause,
|
|
110
113
|
});
|
|
111
114
|
}
|
|
112
115
|
let parsed;
|
|
@@ -121,15 +124,15 @@ export class HttpTransport {
|
|
|
121
124
|
if (!response.ok) {
|
|
122
125
|
throw MaterialGraphError.fromResponse({
|
|
123
126
|
...metadata,
|
|
124
|
-
status: response.status,
|
|
125
|
-
body: parsed,
|
|
126
|
-
responseText: text,
|
|
127
|
-
rateLimit,
|
|
128
127
|
apiKey: this.apiKey,
|
|
128
|
+
body: parsed,
|
|
129
129
|
queryValues: [...requestUrl.searchParams.values()],
|
|
130
|
+
rateLimit,
|
|
131
|
+
responseText: text,
|
|
132
|
+
status: response.status,
|
|
130
133
|
});
|
|
131
134
|
}
|
|
132
|
-
return { response, text
|
|
135
|
+
return { parsed, response, text };
|
|
133
136
|
}
|
|
134
137
|
/**
|
|
135
138
|
* Open a streaming operation and hand back its UNREAD byte body — the one
|
|
@@ -152,20 +155,20 @@ export class HttpTransport {
|
|
|
152
155
|
let response;
|
|
153
156
|
try {
|
|
154
157
|
response = await this.fetch(url, {
|
|
155
|
-
|
|
158
|
+
body: hasBody ? JSON.stringify(options.body) : undefined,
|
|
156
159
|
headers: this.authHeaders({
|
|
157
160
|
Accept: options.accept,
|
|
158
161
|
...(hasBody ? { "Content-Type": "application/json" } : {}),
|
|
159
162
|
}),
|
|
160
|
-
|
|
163
|
+
method: sdkOperation.method,
|
|
161
164
|
signal: options.signal,
|
|
162
165
|
});
|
|
163
166
|
}
|
|
164
167
|
catch (cause) {
|
|
165
168
|
throw MaterialGraphError.fromTransport({
|
|
166
169
|
...metadata,
|
|
167
|
-
cause,
|
|
168
170
|
callerSignal: options.signal,
|
|
171
|
+
cause,
|
|
169
172
|
});
|
|
170
173
|
}
|
|
171
174
|
const rateLimit = parseRateLimit(response.headers);
|
|
@@ -191,12 +194,12 @@ export class HttpTransport {
|
|
|
191
194
|
}
|
|
192
195
|
throw MaterialGraphError.fromResponse({
|
|
193
196
|
...metadata,
|
|
194
|
-
status: response.status,
|
|
195
|
-
body: parsed,
|
|
196
|
-
responseText: text,
|
|
197
|
-
rateLimit,
|
|
198
197
|
apiKey: this.apiKey,
|
|
198
|
+
body: parsed,
|
|
199
199
|
queryValues: [...requestUrl.searchParams.values()],
|
|
200
|
+
rateLimit,
|
|
201
|
+
responseText: text,
|
|
202
|
+
status: response.status,
|
|
200
203
|
});
|
|
201
204
|
}
|
|
202
205
|
if (response.body === null) {
|
|
@@ -209,16 +212,16 @@ export class HttpTransport {
|
|
|
209
212
|
const url = this.buildUrl(operationPath(sdkOperation, options.pathParams), options.query);
|
|
210
213
|
const hasBody = options.body !== undefined;
|
|
211
214
|
const { parsed } = await this.send({
|
|
212
|
-
|
|
213
|
-
url,
|
|
215
|
+
body: hasBody ? JSON.stringify(options.body) : undefined,
|
|
214
216
|
headers: this.authHeaders({
|
|
215
217
|
...(hasBody ? { "Content-Type": "application/json" } : {}),
|
|
216
218
|
...(options.idempotencyKey
|
|
217
219
|
? { "Idempotency-Key": options.idempotencyKey }
|
|
218
220
|
: {}),
|
|
219
221
|
}),
|
|
220
|
-
|
|
222
|
+
method: sdkOperation.method,
|
|
221
223
|
signal: options.signal,
|
|
224
|
+
url,
|
|
222
225
|
});
|
|
223
226
|
return parsed;
|
|
224
227
|
}
|
package/identify-types.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* These intentionally mirror the domain-owned Zod contract rather than
|
|
5
5
|
* importing it: the published SDK must carry no workspace package dependency.
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export type IdentifySelectedPageInput = {
|
|
8
8
|
url: string;
|
|
9
9
|
title?: string;
|
|
10
10
|
selectedText?: string;
|
|
@@ -14,8 +14,8 @@ export interface IdentifySelectedPageInput {
|
|
|
14
14
|
manufacturerCode?: string;
|
|
15
15
|
imageUrls?: string[];
|
|
16
16
|
colourHexes?: string[];
|
|
17
|
-
}
|
|
18
|
-
export
|
|
17
|
+
};
|
|
18
|
+
export type IdentifySelectedPageSubject = {
|
|
19
19
|
kind: "variant" | "product" | "brand";
|
|
20
20
|
id: string;
|
|
21
21
|
name: string;
|
|
@@ -24,20 +24,20 @@ export interface IdentifySelectedPageSubject {
|
|
|
24
24
|
name: string;
|
|
25
25
|
slug: string;
|
|
26
26
|
};
|
|
27
|
-
}
|
|
28
|
-
export
|
|
27
|
+
};
|
|
28
|
+
export type IdentifySelectedPageEvidence = {
|
|
29
29
|
kind: "manufacturer-url" | "brand-homepage" | "visible-identity" | "visual" | "colour";
|
|
30
30
|
url?: string;
|
|
31
31
|
detail: string;
|
|
32
|
-
}
|
|
33
|
-
|
|
32
|
+
};
|
|
33
|
+
type IdentifySelectedPageDataBase = {
|
|
34
34
|
receipt: {
|
|
35
35
|
submittedUrl: string;
|
|
36
36
|
normalizedUrl: string;
|
|
37
37
|
normalizationSteps: string[];
|
|
38
38
|
};
|
|
39
39
|
evidence: IdentifySelectedPageEvidence[];
|
|
40
|
-
}
|
|
40
|
+
};
|
|
41
41
|
export type IdentifySelectedPageData = (IdentifySelectedPageDataBase & {
|
|
42
42
|
outcome: "identified";
|
|
43
43
|
rung: "lookup" | "disambiguate";
|
|
@@ -60,7 +60,7 @@ export type IdentifySelectedPageData = (IdentifySelectedPageDataBase & {
|
|
|
60
60
|
rung?: "match" | "color";
|
|
61
61
|
});
|
|
62
62
|
/** The canonical callable-operation envelope returned by `identify()`. */
|
|
63
|
-
export
|
|
63
|
+
export type IdentifySelectedPageResult = {
|
|
64
64
|
data: IdentifySelectedPageData;
|
|
65
65
|
meta: {
|
|
66
66
|
operationId: "retrieval.identify";
|
|
@@ -68,5 +68,5 @@ export interface IdentifySelectedPageResult {
|
|
|
68
68
|
};
|
|
69
69
|
links: Record<string, never>;
|
|
70
70
|
warnings: [];
|
|
71
|
-
}
|
|
71
|
+
};
|
|
72
72
|
export {};
|
package/index.d.ts
CHANGED
|
@@ -8,15 +8,10 @@ export type * from "./identifiers.js";
|
|
|
8
8
|
export type * from "./exploration-types.js";
|
|
9
9
|
export { TERMINAL_RUN_EVENT_TYPES } from "./run-types.js";
|
|
10
10
|
export type * from "./run-types.js";
|
|
11
|
-
export type * from "./schedule-types.js";
|
|
12
11
|
export type * from "./citation-types.js";
|
|
13
12
|
export { VARY_AXES } from "./composition-types.js";
|
|
14
13
|
export type * from "./composition-types.js";
|
|
15
14
|
export type * from "./slot-pool-types.js";
|
|
16
|
-
export { PROJECT_EVENT_KINDS } from "./project-types.js";
|
|
17
|
-
export type * from "./project-types.js";
|
|
18
|
-
export { COMPOSITION_PHASE_EVENT_TYPES, COMPOSITION_PROGRAMME_EVENT_TYPES, COMPOSITION_REVIEW_CRITERIA_EVENT_TYPES, parseRunEvent, } from "./run-events.js";
|
|
19
|
-
export type * from "./run-events.js";
|
|
20
15
|
export { MATERIALGRAPH_PROBLEM_EXTENSIONS, MaterialGraphError, } from "./errors.js";
|
|
21
16
|
export type { MaterialGraphErrorInit, MaterialGraphErrorKind, MaterialGraphRequestMetadata, ProblemDetail, RateLimit, SanitizedErrorValue, SanitizedIssue, SimpleErrorBody, } from "./errors.js";
|
|
22
17
|
export type * from "./types.js";
|
|
@@ -45,7 +40,6 @@ export type * from "./render-assets-types.js";
|
|
|
45
40
|
export type * from "./material-block-types.js";
|
|
46
41
|
export type * from "./schema-resource-types.js";
|
|
47
42
|
export type * from "./taxonomy-coverage-types.js";
|
|
48
|
-
export type * from "./schedule-reference-types.js";
|
|
49
43
|
export type * from "./substitute-types.js";
|
|
50
44
|
export type * from "./search-refinement-types.js";
|
|
51
45
|
export type * from "./search-window-types.js";
|
package/index.js
CHANGED
|
@@ -2,8 +2,6 @@ export { MaterialGraphClient, DEFAULT_BASE_URL, MAX_BATCH_IDS, } from "./client.
|
|
|
2
2
|
export { MATERIALGRAPH_API_VERSION, SDK_OPERATIONS } from "./operations.js";
|
|
3
3
|
export { TERMINAL_RUN_EVENT_TYPES } from "./run-types.js";
|
|
4
4
|
export { VARY_AXES } from "./composition-types.js";
|
|
5
|
-
export { PROJECT_EVENT_KINDS } from "./project-types.js";
|
|
6
|
-
export { COMPOSITION_PHASE_EVENT_TYPES, COMPOSITION_PROGRAMME_EVENT_TYPES, COMPOSITION_REVIEW_CRITERIA_EVENT_TYPES, parseRunEvent, } from "./run-events.js";
|
|
7
5
|
export { MATERIALGRAPH_PROBLEM_EXTENSIONS, MaterialGraphError, } from "./errors.js";
|
|
8
6
|
export { MATCH_IMAGE_TYPES, MATCH_OUTCOMES, MATCH_MATERIAL_FUNCTIONS, MATCH_STREAM_EVENT_TYPES, MATCH_SURFACE_STATUSES, MATCH_WORKFLOW_STEPS, } from "./match-stream-types.js";
|
|
9
7
|
export { CodesClient } from "./codes-client.js";
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* never a catalogue correction; wrong facts about a product go through
|
|
5
5
|
* `createCorrection`.
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export type RejectMatchResultInput = {
|
|
8
8
|
/**
|
|
9
9
|
* The surface the result was shown under - `surfaces[].surface.id` on a scene
|
|
10
10
|
* match. Omit it for a result from the run-level `results` list.
|
|
@@ -14,9 +14,9 @@ export interface RejectMatchResultInput {
|
|
|
14
14
|
variantId: string;
|
|
15
15
|
/** Optional free text, up to 500 characters. Stored as given. */
|
|
16
16
|
reason?: string;
|
|
17
|
-
}
|
|
17
|
+
};
|
|
18
18
|
/** The receipt for one rejection. A repeat of the same rejection returns the original. */
|
|
19
|
-
export
|
|
19
|
+
export type MatchRejection = {
|
|
20
20
|
rejectionId: string;
|
|
21
21
|
/** The match response's `attribution.responseId`. */
|
|
22
22
|
responseId: string;
|
|
@@ -28,9 +28,9 @@ export interface MatchRejection {
|
|
|
28
28
|
reason: string | null;
|
|
29
29
|
/** ISO-8601. */
|
|
30
30
|
rejectedAt: string;
|
|
31
|
-
}
|
|
31
|
+
};
|
|
32
32
|
/** One match response and every rejection recorded against it. */
|
|
33
|
-
export
|
|
33
|
+
export type MatchRejectionList = {
|
|
34
34
|
responseId: string;
|
|
35
35
|
/** `stream` for a scene match, `buffered` for the single-image JSON response. */
|
|
36
36
|
lane: "buffered" | "stream";
|
|
@@ -40,4 +40,4 @@ export interface MatchRejectionList {
|
|
|
40
40
|
resultCount: number;
|
|
41
41
|
/** Oldest first. Empty means nothing was rejected. */
|
|
42
42
|
rejections: MatchRejection[];
|
|
43
|
-
}
|
|
43
|
+
};
|