@instruments/materialgraph 0.45.0 → 1.0.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 +2 -2
- package/brand-types.d.ts +3 -3
- package/brands-client.d.ts +3 -3
- package/brands-client.js +3 -3
- package/{catalogue-client.d.ts → catalog-client.d.ts} +13 -13
- package/{catalogue-client.js → catalog-client.js} +13 -13
- package/{catalogue-types.d.ts → catalog-types.d.ts} +42 -42
- package/client-config.d.ts +7 -0
- package/client-response-schema.js +1 -1
- package/client-vocabulary.js +1 -1
- package/client.d.ts +13 -12
- package/client.js +19 -14
- package/color-profiles-types.d.ts +1 -1
- package/colors-client.d.ts +6 -6
- package/colors-client.js +3 -3
- package/errors.d.ts +2 -0
- package/errors.js +21 -3
- package/find-sampled-together-types.d.ts +2 -2
- package/find-variants-by-color-types.d.ts +6 -6
- package/find-variants-by-vector-types.d.ts +12 -11
- package/get-variant-types.d.ts +26 -0
- package/http-transport.d.ts +2 -0
- package/http-transport.js +17 -3
- package/identifiers.d.ts +1 -1
- package/image-reference-types.d.ts +2 -2
- package/index.d.ts +5 -5
- package/list-variant-facets-types.d.ts +2 -2
- package/list-variants-types.d.ts +14 -5
- package/material-asset-types.d.ts +1 -1
- package/operation-responses.d.ts +8 -8
- package/operations.generated.d.ts +1 -1
- package/operations.generated.js +14 -14
- package/package.json +2 -2
- package/resolve-color-types.d.ts +13 -13
- package/resolve-variant-types.d.ts +1 -1
- package/response-schemas.generated.d.ts +2 -2
- package/response-schemas.generated.js +43 -42
- package/response-schemas.js +20 -20
- package/runs.js +1 -1
- package/{samplize-catalogue-types.d.ts → samplize-catalog-types.d.ts} +5 -5
- package/samplize-colorvec.d.ts +1 -1
- package/samplize-colorvec.js +2 -2
- package/{search-catalogue-subset-types.d.ts → search-catalog-subset-types.d.ts} +5 -5
- package/search-variants-types.d.ts +4 -4
- package/types.d.ts +6 -6
- package/webmcp.generated.js +4 -4
- /package/{catalogue-types.js → catalog-types.js} +0 -0
- /package/{samplize-catalogue-types.js → samplize-catalog-types.js} +0 -0
- /package/{search-catalogue-subset-types.js → search-catalog-subset-types.js} +0 -0
|
@@ -55,6 +55,6 @@ export type ColorProfilesParams = {
|
|
|
55
55
|
groupBy?: "group" | "type" | "merged";
|
|
56
56
|
/** Representative colors per category, 1 to 64. The server defaults to 8. */
|
|
57
57
|
topN?: number;
|
|
58
|
-
/** `"diverse"`
|
|
58
|
+
/** `"diverse"` maximizes visual distinctness instead of frequency. */
|
|
59
59
|
select?: "frequency" | "diverse";
|
|
60
60
|
};
|
package/colors-client.d.ts
CHANGED
|
@@ -11,9 +11,9 @@ import type { JsonOperationId, OperationResponses } from "./operation-responses.
|
|
|
11
11
|
* The namespace holds no transport of its own: the client hands it a bound
|
|
12
12
|
* `get`, so auth, rate-limit accounting and error shaping stay in one place.
|
|
13
13
|
*
|
|
14
|
-
* `profiles` is an aggregate
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* `profiles` is an aggregate over a category. It is counted live at request
|
|
15
|
+
* time from `resolved_variant_bands`, the dominant color of each searchable
|
|
16
|
+
* variant, so it is as current as the last write to a variant.
|
|
17
17
|
*
|
|
18
18
|
* ROUTING OUT OF THIS NAMESPACE. Color is a lens, and this is not the only
|
|
19
19
|
* door into it:
|
|
@@ -35,7 +35,7 @@ export type ColorsTransport = {
|
|
|
35
35
|
export declare class ColorsClient {
|
|
36
36
|
#private;
|
|
37
37
|
constructor(transport: ColorsTransport);
|
|
38
|
-
/** Nearest Samplize
|
|
38
|
+
/** Nearest Samplize catalog paints for up to twelve hexes, deduplicated in input order. */
|
|
39
39
|
nearestPaints(params: NearestPaintsParams, signal?: AbortSignal): Promise<NearestPaintsOutput>;
|
|
40
40
|
/**
|
|
41
41
|
* THE QUESTION: "what colors does this CATEGORY come in?" - the
|
|
@@ -44,8 +44,8 @@ export declare class ColorsClient {
|
|
|
44
44
|
*
|
|
45
45
|
* An aggregate over a category, not a list of materials: use
|
|
46
46
|
* `mg.findVariantsByColor()` or `mg.searchVariants()` when you want the
|
|
47
|
-
* materials themselves.
|
|
48
|
-
*
|
|
47
|
+
* materials themselves. The counts are read live at
|
|
48
|
+
* request time from `resolved_variant_bands`, so they do not lag the catalog.
|
|
49
49
|
*
|
|
50
50
|
* `groupBy: "group"` takes product-type GROUP keys and merges every leaf type
|
|
51
51
|
* under a group into one histogram BEFORE ranking - a group's palette, not
|
package/colors-client.js
CHANGED
|
@@ -3,7 +3,7 @@ export class ColorsClient {
|
|
|
3
3
|
constructor(transport) {
|
|
4
4
|
this.#transport = transport;
|
|
5
5
|
}
|
|
6
|
-
/** Nearest Samplize
|
|
6
|
+
/** Nearest Samplize catalog paints for up to twelve hexes, deduplicated in input order. */
|
|
7
7
|
async nearestPaints(params, signal) {
|
|
8
8
|
return await this.#transport.get("find_nearest_paints", { hex: params.hexes, limit: params.limit }, signal);
|
|
9
9
|
}
|
|
@@ -14,8 +14,8 @@ export class ColorsClient {
|
|
|
14
14
|
*
|
|
15
15
|
* An aggregate over a category, not a list of materials: use
|
|
16
16
|
* `mg.findVariantsByColor()` or `mg.searchVariants()` when you want the
|
|
17
|
-
* materials themselves.
|
|
18
|
-
*
|
|
17
|
+
* materials themselves. The counts are read live at
|
|
18
|
+
* request time from `resolved_variant_bands`, so they do not lag the catalog.
|
|
19
19
|
*
|
|
20
20
|
* `groupBy: "group"` takes product-type GROUP keys and merges every leaf type
|
|
21
21
|
* under a group into one histogram BEFORE ranking - a group's palette, not
|
package/errors.d.ts
CHANGED
|
@@ -26,6 +26,8 @@ export type ProblemDetail = {
|
|
|
26
26
|
};
|
|
27
27
|
/** Normalized residual `{ error }` body. Unknown response fields are discarded. */
|
|
28
28
|
export type SimpleErrorBody = {
|
|
29
|
+
/** The vector and variant routes' machine-readable code, when the body is `{ code, message }`. */
|
|
30
|
+
code?: string;
|
|
29
31
|
error: string;
|
|
30
32
|
issues?: SanitizedIssue[];
|
|
31
33
|
};
|
package/errors.js
CHANGED
|
@@ -157,10 +157,23 @@ const normalizeProblem = (body, secrets) => {
|
|
|
157
157
|
};
|
|
158
158
|
};
|
|
159
159
|
const normalizeSimple = (body, secrets) => {
|
|
160
|
-
if (!isRecord(body)
|
|
160
|
+
if (!isRecord(body)) {
|
|
161
161
|
return undefined;
|
|
162
162
|
}
|
|
163
163
|
const issues = sanitizeIssues(body.issues, secrets);
|
|
164
|
+
// `{ code, message }` is the vector routes' error body; keep its code.
|
|
165
|
+
if (typeof body.error !== "string" &&
|
|
166
|
+
typeof body.code === "string" &&
|
|
167
|
+
typeof body.message === "string") {
|
|
168
|
+
return {
|
|
169
|
+
code: safeString(body.code, secrets),
|
|
170
|
+
error: safeString(body.message, secrets),
|
|
171
|
+
...(issues === undefined ? {} : { issues }),
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
if (typeof body.error !== "string") {
|
|
175
|
+
return undefined;
|
|
176
|
+
}
|
|
164
177
|
return {
|
|
165
178
|
error: safeString(body.error, secrets),
|
|
166
179
|
...(issues === undefined ? {} : { issues }),
|
|
@@ -211,7 +224,12 @@ export class MaterialGraphError extends Error {
|
|
|
211
224
|
});
|
|
212
225
|
}
|
|
213
226
|
static fromTransport(input) {
|
|
214
|
-
|
|
227
|
+
// A deadline (`AbortSignal.timeout`, or the client's `timeoutMs`) aborts
|
|
228
|
+
// the signal with a TimeoutError reason: that is a timeout, not a
|
|
229
|
+
// cancellation by the caller.
|
|
230
|
+
const reason = input.callerSignal?.reason;
|
|
231
|
+
const reasonName = reason instanceof Error ? reason.name : "";
|
|
232
|
+
if (input.callerSignal?.aborted === true && reasonName !== "TimeoutError") {
|
|
215
233
|
return new MaterialGraphError("MaterialGraph request aborted by caller", {
|
|
216
234
|
...requestMetadata(input),
|
|
217
235
|
kind: "aborted",
|
|
@@ -219,7 +237,7 @@ export class MaterialGraphError extends Error {
|
|
|
219
237
|
});
|
|
220
238
|
}
|
|
221
239
|
const name = input.cause instanceof Error ? input.cause.name : "";
|
|
222
|
-
if (name === "TimeoutError") {
|
|
240
|
+
if (name === "TimeoutError" || reasonName === "TimeoutError") {
|
|
223
241
|
return new MaterialGraphError("MaterialGraph request timed out", {
|
|
224
242
|
...requestMetadata(input),
|
|
225
243
|
kind: "timeout",
|
|
@@ -65,8 +65,8 @@ export type FindSampledTogetherOutput = {
|
|
|
65
65
|
variantId: string;
|
|
66
66
|
variantName: string | null;
|
|
67
67
|
}[];
|
|
68
|
-
/** Seed ids outside the materials
|
|
69
|
-
|
|
68
|
+
/** Seed ids outside the materials catalog; present only when at least one was. */
|
|
69
|
+
excludedBySearchCatalogSubset?: string[];
|
|
70
70
|
/** References that matched no variant. */
|
|
71
71
|
unresolved: string[];
|
|
72
72
|
};
|
|
@@ -12,7 +12,7 @@ import type { ImageReferenceInput } from "./image-reference-types.js";
|
|
|
12
12
|
* are copied here rather than imported. `contract-parity.test.ts` keeps this
|
|
13
13
|
* mirror honest against the server types.
|
|
14
14
|
*/
|
|
15
|
-
import type {
|
|
15
|
+
import type { SearchCatalogSubset, SearchCatalogSubsetReceipt } from "./search-catalog-subset-types.js";
|
|
16
16
|
export type FindVariantsByColorMode = "contains" | "palette" | "rerank";
|
|
17
17
|
/** One color condition. `role` defaults to `required`; every other field defaults to absent/false/0. */
|
|
18
18
|
export type ColorConditionInput = {
|
|
@@ -33,7 +33,7 @@ export type FindVariantsByColorInput = {
|
|
|
33
33
|
colors?: ColorConditionInput[];
|
|
34
34
|
/** Material Bank category IDs or exact source paths, including descendants against actual memberships. Materials and decking only. */
|
|
35
35
|
categoryIds?: string[];
|
|
36
|
-
|
|
36
|
+
searchCatalogSubset?: SearchCatalogSubset;
|
|
37
37
|
cursor?: string;
|
|
38
38
|
/** Palette only: targets from this image's colors, not `colors[]`. */
|
|
39
39
|
image?: ImageReferenceInput;
|
|
@@ -67,7 +67,7 @@ export type PaintCatalogVariant = {
|
|
|
67
67
|
variantName: string | null;
|
|
68
68
|
};
|
|
69
69
|
export type ResolvedColor = {
|
|
70
|
-
|
|
70
|
+
catalogVariant: PaintCatalogVariant | null;
|
|
71
71
|
hex: string;
|
|
72
72
|
index: number;
|
|
73
73
|
/** `region`: a named meaning's own OKLCh bounds, kept — never collapsed to one hex. */
|
|
@@ -194,9 +194,9 @@ export type CompareColorSimilarityReference = {
|
|
|
194
194
|
};
|
|
195
195
|
export type FindVariantsByColorRerankResult = {
|
|
196
196
|
/** Present ONLY when the request narrowed it. ABSENT means the whole graph. */
|
|
197
|
-
|
|
198
|
-
/** Real variant ids outside `
|
|
199
|
-
|
|
197
|
+
searchCatalogSubset?: SearchCatalogSubsetReceipt;
|
|
198
|
+
/** Real variant ids outside `searchCatalogSubset` or the materials catalog. Present when a scope narrowed or any was excluded. */
|
|
199
|
+
excludedBySearchCatalogSubset?: string[];
|
|
200
200
|
/** Candidates ranked by ascending color distance; unembedded ones last. */
|
|
201
201
|
matches: ColorRankMatch[];
|
|
202
202
|
mode: "rerank";
|
|
@@ -8,13 +8,13 @@ import type { PaintCatalogVariant } from "./find-variants-by-color-types.js";
|
|
|
8
8
|
* are copied here and `contract-parity.test.ts` keeps them honest.
|
|
9
9
|
*/
|
|
10
10
|
import type { ImageReferenceInput } from "./image-reference-types.js";
|
|
11
|
-
import type { FilterGroups,
|
|
12
|
-
import type {
|
|
11
|
+
import type { FilterGroups, VariantCard } from "./list-variants-types.js";
|
|
12
|
+
import type { SearchCatalogSubset } from "./search-catalog-subset-types.js";
|
|
13
13
|
export declare const FIND_VARIANTS_BY_VECTOR_MODES: readonly ["text", "image", "text_and_image"];
|
|
14
14
|
export type FindVariantsByVectorMode = (typeof FIND_VARIANTS_BY_VECTOR_MODES)[number];
|
|
15
15
|
export type FindVariantsByVectorQuery = {
|
|
16
|
-
/**
|
|
17
|
-
|
|
16
|
+
/** One to six image references, each with exactly one field. Several are combined into one query, and every seed image's variant is left out. Only for image modes. Each image that has to be embedded spends one of the embed requests. */
|
|
17
|
+
images?: ImageReferenceInput[];
|
|
18
18
|
mode: FindVariantsByVectorMode;
|
|
19
19
|
/** Description, mood words included. Only for text modes. */
|
|
20
20
|
text?: string;
|
|
@@ -29,9 +29,9 @@ export type FindVariantsByVectorInput = {
|
|
|
29
29
|
limit?: number;
|
|
30
30
|
query: FindVariantsByVectorQuery;
|
|
31
31
|
/** Only this corpus scope. Absent or all: every variant. */
|
|
32
|
-
|
|
32
|
+
searchCatalogSubset?: SearchCatalogSubset;
|
|
33
33
|
};
|
|
34
|
-
export type FindVariantsByVectorItem = Omit<
|
|
34
|
+
export type FindVariantsByVectorItem = Omit<VariantCard, "materialBankId"> & {
|
|
35
35
|
/** The variant's Material Bank SKU; null means none is recorded. Always present here, unlike `list_variants`' optional field. */
|
|
36
36
|
materialBankId: string | null;
|
|
37
37
|
/** Voyage cosine to the query. Ranks only; not a probability. */
|
|
@@ -40,7 +40,7 @@ export type FindVariantsByVectorItem = Omit<ListVariantsItem, "materialBankId">
|
|
|
40
40
|
export type FindVariantsByVectorReference = {
|
|
41
41
|
id: string;
|
|
42
42
|
kind: "url" | "assetId" | "variantId" | "sourceId";
|
|
43
|
-
}
|
|
43
|
+
};
|
|
44
44
|
export type FindVariantsByVectorScan = {
|
|
45
45
|
/** True when no further candidates match; false means more may exist. */
|
|
46
46
|
exhausted: boolean;
|
|
@@ -57,12 +57,13 @@ export type FindVariantsByVectorTimings = {
|
|
|
57
57
|
verifyMs: number;
|
|
58
58
|
};
|
|
59
59
|
export type FindVariantsByVectorOutput = {
|
|
60
|
-
/** Explicit `{field: "variant", op: "in"}` filter ids that name a real variant outside the materials
|
|
61
|
-
|
|
60
|
+
/** Explicit `{field: "variant", op: "in"}` filter ids that name a real variant outside the materials catalog — present only when at least one did. */
|
|
61
|
+
excludedBySearchCatalogSubset?: string[];
|
|
62
62
|
items: FindVariantsByVectorItem[];
|
|
63
63
|
mode: FindVariantsByVectorMode;
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
/** The image references the query used, in order. Empty in text mode. */
|
|
65
|
+
references: FindVariantsByVectorReference[];
|
|
66
|
+
/** The exact brand paint named by the text query, when held in the catalog. */
|
|
66
67
|
namedPaint?: PaintCatalogVariant;
|
|
67
68
|
scan: FindVariantsByVectorScan;
|
|
68
69
|
timings: FindVariantsByVectorTimings;
|
package/get-variant-types.d.ts
CHANGED
|
@@ -15,6 +15,30 @@ export type GetVariantOptions = {
|
|
|
15
15
|
attributes?: readonly string[];
|
|
16
16
|
/** Canonical block ids, returned whole, e.g. `["acoustic"]`. */
|
|
17
17
|
blocks?: readonly string[];
|
|
18
|
+
/** Add `ifc`: the IFC 4.3 manufacturer property set and classification references. */
|
|
19
|
+
ifc?: boolean;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* The variant as an IFC 4.3 type states it. Properties the record does not
|
|
23
|
+
* hold are left out, so an absent property is unknown.
|
|
24
|
+
*/
|
|
25
|
+
export type GetVariantIfc = {
|
|
26
|
+
propertySets: {
|
|
27
|
+
name: "Pset_ManufacturerTypeInformation";
|
|
28
|
+
properties: {
|
|
29
|
+
name: string;
|
|
30
|
+
value: string;
|
|
31
|
+
dataType: "IfcLabel" | "IfcIdentifier";
|
|
32
|
+
/** The property's bSDD URI. */
|
|
33
|
+
uri: string;
|
|
34
|
+
}[];
|
|
35
|
+
}[];
|
|
36
|
+
classificationReferences: {
|
|
37
|
+
classification: "MasterFormat" | "OmniClass" | "UniFormat";
|
|
38
|
+
identification: string;
|
|
39
|
+
name?: string;
|
|
40
|
+
edition?: string;
|
|
41
|
+
}[];
|
|
18
42
|
};
|
|
19
43
|
/**
|
|
20
44
|
* One variant: the compact identity, and `specifications` only for the
|
|
@@ -71,6 +95,8 @@ export type GetVariantOutput = {
|
|
|
71
95
|
name: string;
|
|
72
96
|
/** Requested blocks or attributes the variant's product type does not carry. */
|
|
73
97
|
notApplicable?: ListVariantsNotApplicable;
|
|
98
|
+
/** Present when `ifc` was asked for. */
|
|
99
|
+
ifc?: GetVariantIfc;
|
|
74
100
|
product: {
|
|
75
101
|
id: string;
|
|
76
102
|
name: string;
|
package/http-transport.d.ts
CHANGED
|
@@ -35,6 +35,8 @@ export type HttpTransportOptions = {
|
|
|
35
35
|
apiKey: string;
|
|
36
36
|
baseUrl: string;
|
|
37
37
|
fetch: typeof fetch;
|
|
38
|
+
/** Deadline in milliseconds for each JSON or upload request. Not applied to streams. */
|
|
39
|
+
timeoutMs?: number;
|
|
38
40
|
};
|
|
39
41
|
export declare class HttpTransport {
|
|
40
42
|
#private;
|
package/http-transport.js
CHANGED
|
@@ -32,11 +32,23 @@ export class HttpTransport {
|
|
|
32
32
|
baseUrl;
|
|
33
33
|
apiKey;
|
|
34
34
|
fetch;
|
|
35
|
+
#timeoutMs;
|
|
35
36
|
#lastRateLimit = null;
|
|
36
37
|
constructor(options) {
|
|
37
38
|
this.apiKey = options.apiKey;
|
|
38
39
|
this.baseUrl = options.baseUrl.replace(/\/+$/u, "");
|
|
39
40
|
this.fetch = options.fetch;
|
|
41
|
+
this.#timeoutMs = options.timeoutMs;
|
|
42
|
+
}
|
|
43
|
+
/** The caller's signal and the client deadline, whichever fires first. */
|
|
44
|
+
#withDeadline(signal) {
|
|
45
|
+
if (this.#timeoutMs === undefined) {
|
|
46
|
+
return signal;
|
|
47
|
+
}
|
|
48
|
+
const deadline = AbortSignal.timeout(this.#timeoutMs);
|
|
49
|
+
return signal === undefined
|
|
50
|
+
? deadline
|
|
51
|
+
: AbortSignal.any([signal, deadline]);
|
|
40
52
|
}
|
|
41
53
|
get lastRateLimit() {
|
|
42
54
|
return this.#lastRateLimit;
|
|
@@ -83,19 +95,21 @@ export class HttpTransport {
|
|
|
83
95
|
origin: requestUrl.origin,
|
|
84
96
|
path: requestUrl.pathname,
|
|
85
97
|
};
|
|
98
|
+
// The deadline covers the whole request, body read included.
|
|
99
|
+
const signal = this.#withDeadline(input.signal);
|
|
86
100
|
let response;
|
|
87
101
|
try {
|
|
88
102
|
response = await this.fetch(input.url, {
|
|
89
103
|
body: input.body,
|
|
90
104
|
headers: input.headers,
|
|
91
105
|
method: input.method,
|
|
92
|
-
signal
|
|
106
|
+
signal,
|
|
93
107
|
});
|
|
94
108
|
}
|
|
95
109
|
catch (cause) {
|
|
96
110
|
throw MaterialGraphError.fromTransport({
|
|
97
111
|
...metadata,
|
|
98
|
-
callerSignal:
|
|
112
|
+
callerSignal: signal,
|
|
99
113
|
cause,
|
|
100
114
|
});
|
|
101
115
|
}
|
|
@@ -108,7 +122,7 @@ export class HttpTransport {
|
|
|
108
122
|
catch (cause) {
|
|
109
123
|
throw MaterialGraphError.fromTransport({
|
|
110
124
|
...metadata,
|
|
111
|
-
callerSignal:
|
|
125
|
+
callerSignal: signal,
|
|
112
126
|
cause,
|
|
113
127
|
});
|
|
114
128
|
}
|
package/identifiers.d.ts
CHANGED
|
@@ -63,7 +63,7 @@ export type SlotId = OpaqueId;
|
|
|
63
63
|
/**
|
|
64
64
|
* A pagination cursor. Opaque keyset state, not an offset and not a page
|
|
65
65
|
* number: pass the value you were handed back unchanged to continue, and never
|
|
66
|
-
*
|
|
66
|
+
* synthesize one. A response with no cursor is the end of the walk.
|
|
67
67
|
*
|
|
68
68
|
* A cursor is only valid for the query that produced it — changing sort,
|
|
69
69
|
* filters or limit invalidates it.
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* @module image-reference-types
|
|
3
3
|
* @description The one image-reference shape the vector-discovery lenses
|
|
4
4
|
* share (`@materialgraph/search/vector-discovery/image-reference`'s
|
|
5
|
-
* `imageReferenceInputSchema`): a
|
|
5
|
+
* `imageReferenceInputSchema`): a catalog asset, an upload, a public URL,
|
|
6
6
|
* or an existing variant's own image. Exactly one field is set per call; the
|
|
7
7
|
* server refuses more than one.
|
|
8
8
|
*/
|
|
9
9
|
export type ImageReferenceInput = {
|
|
10
|
-
/**
|
|
10
|
+
/** Catalog asset id. */
|
|
11
11
|
assetId?: string;
|
|
12
12
|
/** Upload id (`smf_...`) from source-material. */
|
|
13
13
|
sourceId?: string;
|
package/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export { MaterialGraphClient, DEFAULT_BASE_URL } from "./client.js";
|
|
2
2
|
export type { MaterialGraphClientOptions } from "./client.js";
|
|
3
|
-
export type { FilterOp, FilterTermCondition, FilterNumericCondition, FilterPresenceCondition, FilterAnyFieldCondition, FilterCondition, FilterGroups, OptionalFilterGroups, OrderByEntry, ListVariantsInclude, ListVariantsCollapse, ColorRegion, ColorRangeCondition, ListVariantsInput, ListVariantsPreference, ListVariantsSpecifications, ListVariantsNotApplicable, SampleSubject, ListVariantsItem, ListVariantsOutput, } from "./list-variants-types.js";
|
|
3
|
+
export type { FilterOp, FilterTermCondition, FilterNumericCondition, FilterPresenceCondition, FilterAnyFieldCondition, FilterCondition, FilterGroups, OptionalFilterGroups, OrderByEntry, ListVariantsInclude, ListVariantsCollapse, ColorRegion, ColorRangeCondition, ListVariantsInput, ListVariantsPreference, ListVariantsSpecifications, ListVariantsNotApplicable, SampleSubject, ListVariantsItem, ListVariantsOutput, VariantCard, } from "./list-variants-types.js";
|
|
4
4
|
export type { ListVariantFacetsInput, VariantFacetValue, CategoricalVariantFacet, BooleanVariantFacet, NumericVariantFacet, VariantFacet, ListVariantFacetsOutput, } from "./list-variant-facets-types.js";
|
|
5
5
|
export type { SearchVariantsSelection, SearchVariantsInput, SearchVariantsUnderstood, SearchVariantsReading, SearchVariantsChoice, SearchVariantsOutput, } from "./search-variants-types.js";
|
|
6
6
|
export type { ListEnumValuesOptions, EnumValueMatch, EnumValueItem, ListEnumValuesResult, } from "./list-enum-values-types.js";
|
|
7
|
-
export type { GetVariantOptions, GetVariantOutput, } from "./get-variant-types.js";
|
|
7
|
+
export type { GetVariantIfc, GetVariantOptions, GetVariantOutput, } from "./get-variant-types.js";
|
|
8
8
|
export type { ImageReferenceInput } from "./image-reference-types.js";
|
|
9
9
|
export type { SampledTogetherProjectType, FindSampledTogetherInput, FindSampledTogetherRow, FindSampledTogetherOutput, } from "./find-sampled-together-types.js";
|
|
10
10
|
export type { FindVariantsByColorMode, ColorConditionInput, FindVariantsByColorInput, ColorConditionReceipt, PaintCatalogVariant, ResolvedColor, ColorAlternative, UnresolvedColor, ColorVariantMatch, ColorPageInfo, FindVariantsByColorContainsResult, FindVariantsByColorPaletteResult, ColorRankedSeed, ColorRankMatch, ResolvedColorReference, CompareColorSimilarityReference, FindVariantsByColorRerankResult, FindVariantsByColorOutput, } from "./find-variants-by-color-types.js";
|
|
@@ -17,9 +17,9 @@ export { TERMINAL_RUN_EVENT_TYPES } from "./run-types.js";
|
|
|
17
17
|
export type { FileInput, UploadSourceMaterialInput, SourceMaterialReceiptFile, SourceMaterialBatchReceipt, PublicRunStatus, PublicRunFailure, PublicRunArtifactRef, PublicRun, CreatePublicRunRequest, CreatePublicRunResponse, PublicRunResponse, RunEvent, StreamRunEventsOptions, DrainRunEventsOptions, } from "./run-types.js";
|
|
18
18
|
export { MATERIALGRAPH_PROBLEM_EXTENSIONS, MaterialGraphError, } from "./errors.js";
|
|
19
19
|
export type { MaterialGraphErrorInit, MaterialGraphErrorKind, MaterialGraphRequestMetadata, ProblemDetail, RateLimit, SanitizedErrorValue, SanitizedIssue, SimpleErrorBody, } from "./errors.js";
|
|
20
|
-
export type { OpenEnum, JsonValue, OklabTriple, MaterialColor, ImageSource, MaterialAvailability, MaterialTile, DemandMomentum, CompanionDemand, ProjectTypeShare, CospecPairing, ColorPairing, PairingOrderMode, PairingRanking, PairingOrdering, PairingItem, PairingsResponse, AttributeMatch, AttributeListItem, OutsideScopeAttribute, ListAttributesResult, WhoamiResponse, PairingsOptions, ListAttributesOptions, ExtractedPalette, ExtractPaletteResponse, ExtractPaletteInput, ResolveValueCandidate, ValueResolution, ResolveColorOptions,
|
|
20
|
+
export type { OpenEnum, JsonValue, OklabTriple, MaterialColor, ImageSource, MaterialAvailability, MaterialTile, DemandMomentum, CompanionDemand, ProjectTypeShare, CospecPairing, ColorPairing, PairingOrderMode, PairingRanking, PairingOrdering, PairingItem, PairingsResponse, AttributeMatch, AttributeListItem, OutsideScopeAttribute, ListAttributesResult, WhoamiResponse, PairingsOptions, ListAttributesOptions, ExtractedPalette, ExtractPaletteResponse, ExtractPaletteInput, ResolveValueCandidate, ValueResolution, ResolveColorOptions, ResolveColorCatalogVariant, ResolveColorVariant, ResolveColorResponse, BySpecVerdictState, BySpecVerdictCell, BySpecVerdict, MaterialVerdict, BySpecUnresolvedCriterion, } from "./types.js";
|
|
21
21
|
export type { ResolveVariantInput, ResolveVariantSubject, ResolveVariantEvidence, ResolveVariantReceipt, ResolveVariantUnresolvedReason, ResolveVariantOutput, } from "./resolve-variant-types.js";
|
|
22
|
-
export type {
|
|
22
|
+
export type { CatalogReference, CatalogReferenceAbsenceReason, CatalogReferencePublication, CatalogReferenceResult, CatalogReferenceBatchResponse, CatalogCollectionsOptions, CatalogCollectionSampleProduct, CatalogChannelCollection, CatalogChannelCollectionsResponse, CatalogDocumentAccess, CatalogDocumentAccessResult, CatalogDocument, CatalogEdition, CatalogAvailableReceipt, CatalogFailureReceipt, UnavailableCatalogDocument, CatalogPublication, CatalogDocumentList, CatalogProductReferenceList, CatalogProductReferenceUnavailable, CatalogProductReferenceReadResult, CatalogPageRequiredArtifact, CatalogPageAvailableArtifact, CatalogPage, CatalogPageListResult, CatalogPageRepresentationReadResult, } from "./catalog-types.js";
|
|
23
23
|
export { CategoriesClient } from "./categories-client.js";
|
|
24
24
|
export type { CategoryRef, CategoryKind, CategoryMatch, CategoryItem, CategoriesPageInfo, CategoriesListInput, CategoriesListResult, CategoryConcept, CategoryProductCategory, CategoriesGetResult, } from "./category-types.js";
|
|
25
25
|
export { ColorsClient } from "./colors-client.js";
|
|
@@ -30,5 +30,5 @@ export type { BrandsOptions, BrandItem, ListBrandsPage, } from "./brand-types.js
|
|
|
30
30
|
export type { VariantAssetAvailability, VariantImageRole, VariantImagePresentation, VariantDocumentType, VariantAssetKind, VariantAssetItem, VariantDocumentCoverageState, VariantAssetPageInfo, ListVariantAssetsOptions, VariantAssetPage, MaterialDocumentStatus, MaterialDocumentCoverageState, MaterialDocumentScope, MaterialDocumentSource, MaterialDocumentProjectionItem, MaterialDocumentCoverageSource, MaterialDocumentCoverage, MaterialDocumentCoverageSummary, MaterialDocumentPageOptions, MaterialDocumentPage, } from "./material-asset-types.js";
|
|
31
31
|
export type { MaterialCoverageStatus, MaterialBlockStatus, MaterialBlockFieldStatus, MaterialBlockFieldValue, MaterialBlockProjectionField, MaterialBlockProjectionItem, MaterialBlockProjection, VariantColorPalette, } from "./material-block-types.js";
|
|
32
32
|
export type { SchemaResource, SCHEMA_RESOURCE_OPERATION_IDS, SchemaResourceRequest, SchemaLifecycle, SchemaExternalMapping, SchemaMatchStrength, SchemaValueDictionaryTerm, SchemaValueDictionaryItem, SchemaResourceItemMap, SchemaResourceResponse, } from "./schema-resource-types.js";
|
|
33
|
-
export type { SamplizePublicationSource, SamplizeLrvObservation, SamplizeDemand, SamplizeCollectionMembership,
|
|
33
|
+
export type { SamplizePublicationSource, SamplizeLrvObservation, SamplizeDemand, SamplizeCollectionMembership, SamplizeCatalogOptions, SamplizeCatalogPage, SamplizeCatalogProduct, SamplizeHexObservation, } from "./samplize-catalog-types.js";
|
|
34
34
|
export type { NearestPaintsParams, NearestPaintCard, NearestPaintsHexResult, NearestPaintsOutput, } from "./nearest-paints-types.js";
|
|
@@ -8,13 +8,13 @@ import type { FilterGroups } from "./list-variants-types.js";
|
|
|
8
8
|
* dependency on `@materialgraph/search`, so the shapes are copied here and
|
|
9
9
|
* `contract-parity.test.ts` keeps them honest.
|
|
10
10
|
*/
|
|
11
|
-
import type {
|
|
11
|
+
import type { SearchCatalogSubset } from "./search-catalog-subset-types.js";
|
|
12
12
|
export type ListVariantFacetsInput = {
|
|
13
13
|
/** 1–10 facetable attribute ids, or `brand`. Find attribute ids with `listAttributes()`. */
|
|
14
14
|
attributeIds: string[];
|
|
15
15
|
/** The same kind-grouped filter tree `listVariants()` takes. */
|
|
16
16
|
/** Count only this corpus scope; absent or `all` counts every variant. */
|
|
17
|
-
|
|
17
|
+
searchCatalogSubset?: SearchCatalogSubset;
|
|
18
18
|
filters?: FilterGroups;
|
|
19
19
|
/** Top values per categorical or boolean facet, 1–50. Defaults to 10. */
|
|
20
20
|
valuesPerFacet?: number;
|
package/list-variants-types.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* copied here rather than imported. `contract-parity.test.ts` keeps this
|
|
10
10
|
* mirror honest against the server types.
|
|
11
11
|
*/
|
|
12
|
-
import type {
|
|
12
|
+
import type { SearchCatalogSubset } from "./search-catalog-subset-types.js";
|
|
13
13
|
export type FilterOp = "in" | "not_in" | "all" | "exists" | "missing" | "eq" | "gt" | "gte" | "lt" | "lte";
|
|
14
14
|
export type FilterTermCondition = {
|
|
15
15
|
field: string;
|
|
@@ -132,7 +132,7 @@ export type ListVariantsInput = {
|
|
|
132
132
|
* Only variants in this corpus scope: the rows, the page and the cursor.
|
|
133
133
|
* Absent or `all` is every variant.
|
|
134
134
|
*/
|
|
135
|
-
|
|
135
|
+
searchCatalogSubset?: SearchCatalogSubset;
|
|
136
136
|
cursor?: string;
|
|
137
137
|
/** Every condition, across `terms`/`numbers`/`presence`/`anyField`, must match. */
|
|
138
138
|
filters?: FilterGroups;
|
|
@@ -222,9 +222,18 @@ export type ListVariantsItem = {
|
|
|
222
222
|
variantCount?: number;
|
|
223
223
|
variantId: string;
|
|
224
224
|
};
|
|
225
|
+
/**
|
|
226
|
+
* The variant card both `listVariants` rows and `findVariantsByVector` rows
|
|
227
|
+
* satisfy. The only difference between the two is the Material Bank SKU:
|
|
228
|
+
* absent in a list row when none is recorded, `null` in a vector row.
|
|
229
|
+
*/
|
|
230
|
+
export type VariantCard = Omit<ListVariantsItem, "materialBankId"> & {
|
|
231
|
+
/** The variant's Material Bank SKU. Absent or null means none is recorded. */
|
|
232
|
+
materialBankId?: string | null;
|
|
233
|
+
};
|
|
225
234
|
export type ListVariantsOutput = {
|
|
226
|
-
/** Explicit `{field: "variant", op: "in"}` ids that name a real variant outside the materials
|
|
227
|
-
|
|
235
|
+
/** Explicit `{field: "variant", op: "in"}` ids that name a real variant outside the materials catalog. Present only when at least one did. */
|
|
236
|
+
excludedBySearchCatalogSubset?: string[];
|
|
228
237
|
items: ListVariantsItem[];
|
|
229
238
|
/** Present only when a `name` lookup's first page was empty: each name word, and whether a name in scope starts it. The lookup left out the unmatched words and looked again, unless every word or none matched. */
|
|
230
239
|
nameWords?: {
|
|
@@ -237,7 +246,7 @@ export type ListVariantsOutput = {
|
|
|
237
246
|
};
|
|
238
247
|
/** False: nothing from this page on meets any `optionalFilters` entry. Absent when not measured. */
|
|
239
248
|
preferenceMatchesRemain?: boolean;
|
|
240
|
-
/** Explicit `{field: "variant", op: "in"}` ids that name a variant in the materials
|
|
249
|
+
/** Explicit `{field: "variant", op: "in"}` ids that name a variant in the materials catalog that this list cannot show in the requested `searchCatalogSubset`: retired, not orderable, or outside the scope. Read one with `getVariant`. Present only when at least one did. */
|
|
241
250
|
unavailableVariantIds?: string[];
|
|
242
251
|
/** Explicit `{field: "variant", op: "in"}` ids anywhere in `filters.terms` that name no variant at all. */
|
|
243
252
|
unresolvedVariantIds?: string[];
|
|
@@ -21,7 +21,7 @@ export type VariantImageRole = OpenEnum<"product" | "swatch" | "detail" | "scene
|
|
|
21
21
|
/** How an image must be framed, a different question from what it shows. */
|
|
22
22
|
export type VariantImagePresentation = OpenEnum<"edge_to_edge" | "packshot" | "cutout_margin" | "montage" | "unknown">;
|
|
23
23
|
/** What a document is for; a document can carry more than one purpose. */
|
|
24
|
-
export type VariantDocumentType = OpenEnum<"technical_data_sheet" | "product_sheet" | "technical_bulletin" | "sustainability_report" | "specification" | "installation_guide" | "care_maintenance_guide" | "operation_manual" | "warranty" | "parts_list" | "technical_drawing" | "test_report" | "certificate" | "declaration_of_performance" | "environmental_product_declaration" | "health_product_declaration" | "ingredient_disclosure" | "safety_data_sheet" | "brochure" | "
|
|
24
|
+
export type VariantDocumentType = OpenEnum<"technical_data_sheet" | "product_sheet" | "technical_bulletin" | "sustainability_report" | "specification" | "installation_guide" | "care_maintenance_guide" | "operation_manual" | "warranty" | "parts_list" | "technical_drawing" | "test_report" | "certificate" | "declaration_of_performance" | "environmental_product_declaration" | "health_product_declaration" | "ingredient_disclosure" | "safety_data_sheet" | "brochure" | "catalog" | "color_finish_chart" | "other" | "unknown">;
|
|
25
25
|
/** Every asset kind the registry knows. */
|
|
26
26
|
export type VariantAssetKind = OpenEnum<"image" | "document" | "cad" | "bim" | "model_3d" | "texture" | "archive" | "other" | "unknown">;
|
|
27
27
|
/**
|
package/operation-responses.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Response types belong to operation ids, never a caller-selected generic. */
|
|
2
2
|
import type { ApplicabilityResponse, DeclaredAssociationsResponse } from "./association-types.js";
|
|
3
3
|
import type { ListBrandsPage } from "./brand-types.js";
|
|
4
|
-
import type { CatalogDocumentList, CatalogPageListResult, CatalogProductReferenceReadResult,
|
|
4
|
+
import type { CatalogDocumentList, CatalogPageListResult, CatalogProductReferenceReadResult, CatalogChannelCollectionsResponse, CatalogDocumentAccessResult, CatalogPageRepresentationReadResult, CatalogReferenceBatchResponse } from "./catalog-types.js";
|
|
5
5
|
import type { CategoriesGetResult, CategoriesListResult } from "./category-types.js";
|
|
6
6
|
import type { CategoryColorProfilesResponse } from "./color-profiles-types.js";
|
|
7
7
|
import type { FindSampledTogetherOutput } from "./find-sampled-together-types.js";
|
|
@@ -16,13 +16,13 @@ import type { MaterialBlockProjection } from "./material-block-types.js";
|
|
|
16
16
|
import type { NearestPaintsOutput } from "./nearest-paints-types.js";
|
|
17
17
|
import type { ResolveVariantOutput } from "./resolve-variant-types.js";
|
|
18
18
|
import type { CreatePublicRunResponse, PublicRunResponse, SourceMaterialBatchReceipt } from "./run-types.js";
|
|
19
|
-
import type {
|
|
19
|
+
import type { SamplizeCatalogPage } from "./samplize-catalog-types.js";
|
|
20
20
|
import type { SchemaResourceResponse } from "./schema-resource-types.js";
|
|
21
21
|
import type { SearchVariantsOutput } from "./search-variants-types.js";
|
|
22
22
|
import type { ExtractPaletteResponse, ListAttributesResult, PairingsResponse, ResolveColorResponse, WhoamiResponse } from "./types.js";
|
|
23
23
|
export type OperationResponses = {
|
|
24
24
|
find_nearest_paints: NearestPaintsOutput;
|
|
25
|
-
|
|
25
|
+
get_catalog_generation: {
|
|
26
26
|
generation: number;
|
|
27
27
|
};
|
|
28
28
|
catalog_list_attributes: ListAttributesResult;
|
|
@@ -33,9 +33,9 @@ export type OperationResponses = {
|
|
|
33
33
|
find_variants_by_color: FindVariantsByColorOutput;
|
|
34
34
|
find_variants_by_vector: FindVariantsByVectorOutput;
|
|
35
35
|
get_applicability: ApplicabilityResponse;
|
|
36
|
-
get_catalog_page_representation:
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
get_catalog_page_representation: CatalogPageRepresentationReadResult;
|
|
37
|
+
get_catalog_document_access: CatalogDocumentAccessResult;
|
|
38
|
+
get_catalog_references_batch: CatalogReferenceBatchResponse;
|
|
39
39
|
get_category: CategoriesGetResult;
|
|
40
40
|
get_category_color_profiles: CategoryColorProfilesResponse;
|
|
41
41
|
get_material_pairings: PairingsResponse;
|
|
@@ -47,7 +47,7 @@ export type OperationResponses = {
|
|
|
47
47
|
list_catalog_documents: CatalogDocumentList;
|
|
48
48
|
list_catalog_pages: CatalogPageListResult;
|
|
49
49
|
list_catalog_product_references: CatalogProductReferenceReadResult;
|
|
50
|
-
|
|
50
|
+
list_catalog_channel_collections: CatalogChannelCollectionsResponse;
|
|
51
51
|
list_categories: CategoriesListResult;
|
|
52
52
|
list_material_blocks: MaterialBlockProjection;
|
|
53
53
|
list_material_documents: MaterialDocumentPage;
|
|
@@ -57,7 +57,7 @@ export type OperationResponses = {
|
|
|
57
57
|
list_variants: ListVariantsOutput;
|
|
58
58
|
resolve_color_name: ResolveColorResponse;
|
|
59
59
|
resolve_variant: ResolveVariantOutput;
|
|
60
|
-
|
|
60
|
+
samplize_catalog_products: SamplizeCatalogPage;
|
|
61
61
|
search_variants: SearchVariantsOutput;
|
|
62
62
|
upload_source_material: SourceMaterialBatchReceipt;
|
|
63
63
|
whoami: WhoamiResponse;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const MATERIALGRAPH_API_VERSION = "0.8.0";
|
|
2
|
-
declare const OPERATION_DEFINITIONS: readonly [readonly ["colors.nearestPaints", "GET", "/api/v1/colors/nearest-paints", "find_nearest_paints"], readonly ["
|
|
2
|
+
declare const OPERATION_DEFINITIONS: readonly [readonly ["colors.nearestPaints", "GET", "/api/v1/colors/nearest-paints", "find_nearest_paints"], readonly ["getCatalogGeneration", "GET", "/api/v1/catalog/generation", "get_catalog_generation"], readonly ["catalogs", "GET", "/api/v1/catalogs", "list_catalog_documents"], readonly ["catalogPages", "GET", "/api/v1/catalogs/{catalogId}/pages", "list_catalog_pages"], readonly ["catalogPageRepresentation", "GET", "/api/v1/catalog-pages/{pageId}/representation", "get_catalog_page_representation"], readonly ["catalogReferences", "GET", "/api/v1/catalogs/{catalogId}/references", "list_catalog_product_references"], readonly ["samplizeCatalog", "GET", "/api/v1/catalogs/samplize/products", "samplize_catalog_products"], readonly ["catalogReferencesForVariants", "POST", "/api/v1/catalogs/references", "get_catalog_references_batch"], readonly ["catalogCollections", "GET", "/api/v1/catalogs/collections", "list_catalog_channel_collections"], readonly ["catalogDocumentAccess", "GET", "/api/v1/catalogs/documents/{documentId}", "get_catalog_document_access"], readonly ["materialBlocks", "GET", "/api/v1/materials/{variantId}/blocks", "list_material_blocks"], readonly ["listVariantAssets", "GET", "/api/v1/variants/{variantId}/assets", "list_variant_assets"], readonly ["materialDocuments", "GET", "/api/v1/materials/{variantId}/documents", "list_material_documents"], readonly ["schema", "GET", "/api/v1/schema/value-dictionaries", "list_schema_value_dictionaries"], readonly ["pairings", "GET", "/api/v1/materials/{variantId}/pairings", "get_material_pairings"], readonly ["associatedFinishes", "GET", "/api/v1/associated/finishes", "list_associated_finishes"], readonly ["associatedProducts", "GET", "/api/v1/associated/products", "list_associated_products"], readonly ["applicability", "GET", "/api/v1/applicability", "get_applicability"], readonly ["listVariants", "GET", "/api/v1/variants", "list_variants"], readonly ["listVariantFacets", "POST", "/api/v1/variants/facets", "list_variant_facets"], readonly ["searchVariants", "POST", "/api/v1/variants/search", "search_variants"], readonly ["findVariantsByColor", "GET", "/api/v1/variants/by-color", "find_variants_by_color"], readonly ["findVariantsByVector", "POST", "/api/v1/variants/by-vector", "find_variants_by_vector"], readonly ["findSampledTogether", "GET", "/api/v1/variants/sampled-together", "find_sampled_together"], readonly ["resolveVariant", "POST", "/api/v1/variants/resolve", "resolve_variant"], readonly ["getVariant", "GET", "/api/v1/variants/{variantId}", "get_variant"], readonly ["resolveColor", "GET", "/api/v1/search/colors/resolve", "resolve_color_name"], readonly ["listAttributes", "GET", "/api/v1/catalog/attributes", "catalog_list_attributes"], readonly ["listEnumValues", "GET", "/api/v1/catalog/enum-values", "catalog_list_enum_values"], readonly ["categories.list", "GET", "/api/v1/categories", "list_categories"], readonly ["categories.get", "GET", "/api/v1/categories/{id}", "get_category"], readonly ["whoami", "GET", "/api/v1/whoami", "whoami"], readonly ["colors.profiles", "GET", "/api/v1/colors/profiles", "get_category_color_profiles"], readonly ["extractPalette", "POST", "/api/v1/search/palettes/extract", "extract_image_palette"], readonly ["brands", "GET", "/api/v1/brands", "list_brands"], readonly ["uploadSourceMaterial", "POST", "/api/v1/source-material", "upload_source_material"], readonly ["workflows.start", "POST", "/api/v1/workflows/{workflowId}/runs", "create_public_run"], readonly ["workflows.run", "GET", "/api/v1/workflows/{workflowId}/runs/{runId}", "get_public_run"], readonly ["workflows.streamRunEvents", "GET", "/api/v1/workflows/{workflowId}/runs/{runId}/events", "list_public_run_events"]];
|
|
3
3
|
export type SdkOperationId = (typeof OPERATION_DEFINITIONS)[number][3];
|
|
4
4
|
export type SdkOperation<K extends SdkOperationId = SdkOperationId> = Readonly<{
|
|
5
5
|
clientMethod: (typeof OPERATION_DEFINITIONS)[number][0];
|