@instruments/materialgraph 0.7.1 → 0.8.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 +92 -0
- package/association-types.js +1 -0
- package/associations-client.d.ts +51 -0
- package/associations-client.js +40 -0
- package/by-colour-types.d.ts +119 -0
- package/by-colour-types.js +1 -0
- package/client-config.d.ts +17 -0
- package/client-config.js +9 -0
- package/client.d.ts +34 -22
- package/client.js +46 -32
- package/composition-types.d.ts +31 -1
- package/index.d.ts +2 -0
- package/material-types.d.ts +8 -0
- package/operations.d.ts +7 -1
- package/operations.js +16 -0
- package/package.json +1 -1
- package/resolve-client.d.ts +71 -0
- package/resolve-client.js +51 -0
- package/resolve-types.d.ts +102 -0
- package/resolve-types.js +17 -0
- package/run-types.d.ts +25 -0
- package/runs.d.ts +15 -1
- package/runs.js +24 -0
- package/schema-resource-types.d.ts +17 -14
- package/schema-resource-types.js +17 -1
- package/search-result-validation.js +3 -0
- package/types.d.ts +41 -54
package/types.d.ts
CHANGED
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
* match set. Follow the cursor for the rest, and never report a page size as
|
|
26
26
|
* a total.
|
|
27
27
|
*/
|
|
28
|
+
import type { ByColourSwatch } from "./by-colour-types.js";
|
|
28
29
|
import type { BySpecVerdict } from "./by-spec-types.js";
|
|
29
30
|
import type { Cursor, ProductId, VariantId } from "./identifiers.js";
|
|
30
31
|
import type { MaterialDetail, MaterialTile } from "./material-types.js";
|
|
@@ -39,12 +40,22 @@ export type OpenEnum<T extends string> = T | (string & {});
|
|
|
39
40
|
export type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
40
41
|
[key: string]: JsonValue;
|
|
41
42
|
};
|
|
42
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* One palette swatch of a material's main image — colour DERIVED FROM PRODUCT
|
|
45
|
+
* IMAGERY, so read it as visual likeness, never as a declared colour spec.
|
|
46
|
+
*/
|
|
43
47
|
export interface PaletteSwatch {
|
|
44
48
|
hex: string;
|
|
45
49
|
proportion: number;
|
|
46
50
|
/** Stored human colour name for the swatch, when one was extracted. */
|
|
47
51
|
name?: string | null;
|
|
52
|
+
/**
|
|
53
|
+
* `hex` in OKLab, derived server-side so you can sort or measure swatches
|
|
54
|
+
* without converting them yourself. Additive, so optional: the colour lane and
|
|
55
|
+
* the material record carry it, other surfaces may not, and absent means "not
|
|
56
|
+
* derived here" — never "achromatic".
|
|
57
|
+
*/
|
|
58
|
+
oklab?: OklabTriple;
|
|
48
59
|
}
|
|
49
60
|
/** Loose colour metadata for a search result's main image; every field is independently optional. */
|
|
50
61
|
export interface ColourMeta {
|
|
@@ -109,6 +120,16 @@ export interface SearchResultItem {
|
|
|
109
120
|
product: string;
|
|
110
121
|
brandSlug: string | null;
|
|
111
122
|
productId: ProductId | null;
|
|
123
|
+
/**
|
|
124
|
+
* The variant's Material Bank SKU — the same `materialBankId` the material
|
|
125
|
+
* record carries, so a match card can render straight from a result instead of
|
|
126
|
+
* paying a per-result lookup. Populated on the MATCH lanes (`match()` and
|
|
127
|
+
* `matchStream()` frames).
|
|
128
|
+
*
|
|
129
|
+
* ABSENT means no MB identity is known for the variant — never that the SKU
|
|
130
|
+
* cannot be ordered. Presence is the orderability tell; absence is silence.
|
|
131
|
+
*/
|
|
132
|
+
materialBankId?: string;
|
|
112
133
|
color: string | null;
|
|
113
134
|
variantName: string | null;
|
|
114
135
|
imageUrl: string | null;
|
|
@@ -248,44 +269,6 @@ export interface MatchResponse {
|
|
|
248
269
|
droppedAsDuplicateProduct: number;
|
|
249
270
|
note?: string;
|
|
250
271
|
}
|
|
251
|
-
/** Coarse group + fine type of a colour match's primary product type. */
|
|
252
|
-
export interface MatchCategory {
|
|
253
|
-
group: string | null;
|
|
254
|
-
type: string | null;
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* One colour-palette match.
|
|
258
|
-
*
|
|
259
|
-
* `hex`, `distance` and `closeness` are OKLab geometry over colour EXTRACTED
|
|
260
|
-
* FROM PRODUCT IMAGERY, not declared by the manufacturer. Report it as visual
|
|
261
|
-
* likeness ("reads close to this colour"), never as a stated colour
|
|
262
|
-
* specification.
|
|
263
|
-
*/
|
|
264
|
-
export interface ByColourMatch {
|
|
265
|
-
/** Opaque — round-trip verbatim. */
|
|
266
|
-
variantId: VariantId;
|
|
267
|
-
brand: string;
|
|
268
|
-
product: string;
|
|
269
|
-
color: string | null;
|
|
270
|
-
variantName: string | null;
|
|
271
|
-
imageUrl: string | null;
|
|
272
|
-
hex: string | null;
|
|
273
|
-
distance: number;
|
|
274
|
-
closeness: number;
|
|
275
|
-
category: MatchCategory | null;
|
|
276
|
-
oklab: OklabTriple | null;
|
|
277
|
-
}
|
|
278
|
-
/** The `search/colours` response. */
|
|
279
|
-
export interface ByColourResponse {
|
|
280
|
-
query: {
|
|
281
|
-
colours: string[];
|
|
282
|
-
categories?: string[];
|
|
283
|
-
oklab?: OklabTriple;
|
|
284
|
-
};
|
|
285
|
-
/** `matches.length` — THIS PAGE. Not a corpus total; this surface states none. */
|
|
286
|
-
count: number;
|
|
287
|
-
matches: ByColourMatch[];
|
|
288
|
-
}
|
|
289
272
|
/** One item from the pure colour-scalar browse. */
|
|
290
273
|
export interface BrowseResultItem {
|
|
291
274
|
/** Opaque — round-trip verbatim. */
|
|
@@ -303,6 +286,17 @@ export interface BrowseResultItem {
|
|
|
303
286
|
vibrancy: number | null;
|
|
304
287
|
};
|
|
305
288
|
retired?: boolean;
|
|
289
|
+
/**
|
|
290
|
+
* The row's own image palette — the FULL stored palette of the SAME image
|
|
291
|
+
* `imageUrl` serves, uncapped and in stored order, each swatch with `oklab`
|
|
292
|
+
* (see {@link ByColourSwatch}), so a card can render, sort or group colours
|
|
293
|
+
* without a second call. A one-swatch palette means the extractor found one
|
|
294
|
+
* colour (solid-colour materials are genuinely monochrome), not that the list
|
|
295
|
+
* was trimmed. ABSENT when no palette is on record for that image: absent
|
|
296
|
+
* means unknown, NOT that the material has no colours. These swatches come
|
|
297
|
+
* from product imagery, not from the manufacturer.
|
|
298
|
+
*/
|
|
299
|
+
palette?: ByColourSwatch[];
|
|
306
300
|
}
|
|
307
301
|
/**
|
|
308
302
|
* A single page of the colour browse — the SDK's one genuinely cursor-paginated
|
|
@@ -508,6 +502,7 @@ export interface ResolveAttributeResponse {
|
|
|
508
502
|
candidates: AttributeCandidate[];
|
|
509
503
|
}
|
|
510
504
|
export type * from "./catalog-discovery-types.js";
|
|
505
|
+
export type * from "./resolve-types.js";
|
|
511
506
|
export type * from "./suggest-types.js";
|
|
512
507
|
export type * from "./by-spec-types.js";
|
|
513
508
|
export interface WhoamiResponse {
|
|
@@ -626,20 +621,6 @@ export interface SearchGetParams {
|
|
|
626
621
|
/** Result projection — `"full"` (default) or the lean `"card"` grid form. */
|
|
627
622
|
view?: OpenEnum<"full" | "card">;
|
|
628
623
|
}
|
|
629
|
-
/** Params for `search/colours`. */
|
|
630
|
-
export interface ByColourParams {
|
|
631
|
-
/** A single hex (with or without `#`). */
|
|
632
|
-
hex?: string;
|
|
633
|
-
/** A palette — repeated as one `colour` query entry each. */
|
|
634
|
-
colour?: string | string[];
|
|
635
|
-
/** OKLab triple (all-or-none). */
|
|
636
|
-
l?: number;
|
|
637
|
-
a?: number;
|
|
638
|
-
b?: number;
|
|
639
|
-
/** HARD category filter — display names or taxonomy ids (repeatable). */
|
|
640
|
-
category?: string | string[];
|
|
641
|
-
limit?: number;
|
|
642
|
-
}
|
|
643
624
|
/** Params for the pure colour `search/browse` surface. */
|
|
644
625
|
export interface BrowseParams {
|
|
645
626
|
sort: OpenEnum<"light" | "dark" | "vivid" | "muted" | "colourful">;
|
|
@@ -650,7 +631,13 @@ export interface BrowseParams {
|
|
|
650
631
|
cursor?: Cursor;
|
|
651
632
|
/** Page size. */
|
|
652
633
|
limit?: number;
|
|
653
|
-
/**
|
|
634
|
+
/**
|
|
635
|
+
* Comma-separated taxonomy keys to restrict the browse to, at EITHER tier of
|
|
636
|
+
* `/api/v1/taxonomy/categories`. A GROUP key (`tile_surfaces`) expands to
|
|
637
|
+
* every product type under it, a TYPE key (`ceramic_porcelain_tile`) stands
|
|
638
|
+
* for itself, and a mixed list is their deduplicated union. A key in neither
|
|
639
|
+
* tier is a 400 listing the valid keys — never an empty page.
|
|
640
|
+
*/
|
|
654
641
|
types?: string;
|
|
655
642
|
}
|
|
656
643
|
/** The Material Match request body — exactly one of `imageBase64`, `imageUrl`, `vector`. */
|