@instruments/materialgraph 0.33.0 → 0.35.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.
Files changed (88) hide show
  1. package/association-types.d.ts +11 -11
  2. package/associations-client.d.ts +7 -7
  3. package/associations-client.js +5 -5
  4. package/brand-types.d.ts +37 -41
  5. package/brand-types.js +3 -5
  6. package/brands-client.d.ts +22 -9
  7. package/brands-client.js +20 -6
  8. package/by-spec-types.d.ts +1 -1
  9. package/catalog-discovery-types.d.ts +3 -3
  10. package/catalogue-client.d.ts +2 -50
  11. package/catalogue-client.js +2 -10
  12. package/catalogue-types.d.ts +1 -1
  13. package/categories-client.d.ts +3 -5
  14. package/categories-client.js +1 -1
  15. package/category-types.d.ts +17 -30
  16. package/citation-types.d.ts +2 -2
  17. package/client-vocabulary.d.ts +2 -2
  18. package/client-vocabulary.js +4 -1
  19. package/client.d.ts +57 -100
  20. package/client.js +63 -101
  21. package/color-profiles-types.d.ts +70 -0
  22. package/colors-client.d.ts +76 -0
  23. package/colors-client.js +52 -0
  24. package/find-companions-types.d.ts +8 -8
  25. package/{find-variants-by-colour-types.d.ts → find-variants-by-color-types.d.ts} +70 -64
  26. package/find-variants-by-vector-types.d.ts +4 -1
  27. package/get-variant-types.d.ts +14 -2
  28. package/http-transport.d.ts +1 -1
  29. package/http-transport.js +1 -2
  30. package/identifiers.d.ts +2 -2
  31. package/identifiers.js +1 -1
  32. package/index.d.ts +4 -13
  33. package/index.js +1 -3
  34. package/list-variant-facets-types.d.ts +4 -4
  35. package/list-variants-types.d.ts +71 -21
  36. package/material-asset-types.d.ts +3 -3
  37. package/material-block-types.d.ts +9 -9
  38. package/material-types.d.ts +10 -8
  39. package/operations.d.ts +2 -2
  40. package/operations.js +13 -24
  41. package/package.json +2 -2
  42. package/{resolve-colour-types.d.ts → resolve-color-types.d.ts} +18 -18
  43. package/response-schemas.generated.d.ts +2 -2
  44. package/response-schemas.generated.js +39 -70
  45. package/response-schemas.js +1 -1
  46. package/samplize-catalogue-types.d.ts +4 -4
  47. package/samplize-colorvec.js +6 -6
  48. package/{corpus-scope-types.d.ts → search-catalogue-subset-types.d.ts} +3 -3
  49. package/search-variants-types.d.ts +20 -2
  50. package/types.d.ts +31 -283
  51. package/webmcp.generated.js +4 -9
  52. package/attribution-types.d.ts +0 -51
  53. package/attribution-types.js +0 -13
  54. package/by-colour-types.d.ts +0 -320
  55. package/colour-region-types.d.ts +0 -18
  56. package/colours-client.d.ts +0 -70
  57. package/colours-client.js +0 -38
  58. package/material-query-plan-types.d.ts +0 -70
  59. package/material-query-plan-types.js +0 -1
  60. package/palette-search-types.d.ts +0 -171
  61. package/palette-search-types.js +0 -1
  62. package/query-understanding-types.d.ts +0 -254
  63. package/query-understanding-types.js +0 -1
  64. package/resolve-colour-types.js +0 -1
  65. package/search-card-types.d.ts +0 -86
  66. package/search-card-types.js +0 -1
  67. package/search-index-plan-types.d.ts +0 -74
  68. package/search-index-plan-types.js +0 -1
  69. package/search-refinement-types.d.ts +0 -103
  70. package/search-refinement-types.js +0 -2
  71. package/search-request-types.d.ts +0 -170
  72. package/search-request-types.js +0 -1
  73. package/search-response-receipt-types.d.ts +0 -24
  74. package/search-response-receipt-types.js +0 -1
  75. package/search-response-types.d.ts +0 -11
  76. package/search-response-types.js +0 -1
  77. package/search-result-validation.d.ts +0 -9
  78. package/search-result-validation.js +0 -83
  79. package/spec-types.d.ts +0 -109
  80. package/spec-types.js +0 -54
  81. package/specifications.d.ts +0 -34
  82. package/specifications.js +0 -56
  83. package/validation.d.ts +0 -43
  84. package/validation.js +0 -117
  85. /package/{by-colour-types.js → color-profiles-types.js} +0 -0
  86. /package/{colour-region-types.js → find-variants-by-color-types.js} +0 -0
  87. /package/{corpus-scope-types.js → resolve-color-types.js} +0 -0
  88. /package/{find-variants-by-colour-types.js → search-catalogue-subset-types.js} +0 -0
@@ -1,24 +1,24 @@
1
+ import type { ImageReferenceInput } from "./image-reference-types.js";
1
2
  /**
2
- * @module find-variants-by-colour-types
3
- * @description Hand-maintained mirror of `find_variants_by_colour`'s
3
+ * @module find-variants-by-color-types
4
+ * @description Hand-maintained mirror of `find_variants_by_color`'s
4
5
  * (MG-2217/MG-2230/MG-2247/MG-2328) input and output wire shapes. The source
5
- * of truth is `packages/products/src/search/find-variants-by-colour.ts` —
6
+ * of truth is `packages/products/src/search/find-variants-by-color.ts` —
6
7
  * `rerank`'s `reference.candidates`/`reference.seed` still mirror
7
- * `compare-colour-similarity.ts`'s own seed shape, but its `matches[]` card
8
+ * `compare-color-similarity.ts`'s own seed shape, but its `matches[]` card
8
9
  * is the same shape CONTAINS/PALETTE use, not a copy of that module's result.
9
10
  * This SDK has no RUNTIME dependency on `@materialgraph/products` (it's a
10
11
  * devDependency only, for the parity tests in `__tests__/`), so the shapes
11
12
  * are copied here rather than imported. `contract-parity.test.ts` keeps this
12
13
  * mirror honest against the server types.
13
14
  */
14
- import type { CorpusScope, CorpusScopeReceipt } from "./corpus-scope-types.js";
15
- import type { ImageReferenceInput } from "./image-reference-types.js";
16
- export type FindVariantsByColourMode = "contains" | "palette" | "rerank";
17
- /** One colour condition. `role` defaults to `required`; every other field defaults to absent/false/0. */
18
- export type ColourConditionInput = {
15
+ import type { SearchCatalogueSubset, SearchCatalogueSubsetReceipt } from "./search-catalogue-subset-types.js";
16
+ export type FindVariantsByColorMode = "contains" | "palette" | "rerank";
17
+ /** One color condition. `role` defaults to `required`; every other field defaults to absent/false/0. */
18
+ export type ColorConditionInput = {
19
19
  /** Name, code or hex (e.g. "sage green"). */
20
- colour?: string;
21
- /** Must be the swatch's largest colour. */
20
+ color?: string;
21
+ /** Must be the swatch's largest color. */
22
22
  dominant?: boolean;
23
23
  role?: "required" | "preferred";
24
24
  /** Target (palette) or minimum (contains) share. */
@@ -26,29 +26,31 @@ export type ColourConditionInput = {
26
26
  /** Maximum share, e.g. an accent. */
27
27
  shareMax?: number;
28
28
  };
29
- export type FindVariantsByColourInput = {
29
+ export type FindVariantsByColorInput = {
30
30
  /** Brand slugs or names to filter to. */
31
31
  brands?: string[];
32
- /** One entry per colour (exactly one for rerank). */
33
- colours?: ColourConditionInput[];
34
- corpusScope?: CorpusScope;
32
+ /** One entry per color (exactly one for rerank). */
33
+ colors?: ColorConditionInput[];
34
+ /** Material Bank category IDs or exact source paths, including descendants against actual memberships. Materials and decking only. */
35
+ categoryIds?: string[];
36
+ searchCatalogueSubset?: SearchCatalogueSubset;
35
37
  cursor?: string;
36
- /** Palette only: targets from this image's colours, not `colours[]`. */
38
+ /** Palette only: targets from this image's colors, not `colors[]`. */
37
39
  image?: ImageReferenceInput;
38
40
  limit?: number;
39
- mode: FindVariantsByColourMode;
40
- /** Category keys, e.g. wallcovering, floor_tile, upholstery. */
41
+ mode: FindVariantsByColorMode;
42
+ /** Independent specification type or group keys, e.g. wallcovering or coatings; filters specification types, not source categories. */
41
43
  productTypeIds?: string[];
42
- /** palette: match its palette. rerank: rank by its colour. */
44
+ /** palette: match its palette. rerank: rank by its color. */
43
45
  targetVariantId?: string;
44
- /** Ids to reorder by colour (rerank). */
46
+ /** Ids to reorder by color (rerank). */
45
47
  variantIds?: string[];
46
48
  };
47
- export type ColourConditionReceipt = {
49
+ export type ColorConditionReceipt = {
48
50
  /** OKLab distance to the matched swatch. Never a probability. */
49
51
  distance: number;
50
52
  hex: string;
51
- /** Position in the request's `colours[]`. */
53
+ /** Position in the request's `colors[]`. */
52
54
  index: number;
53
55
  /** The matched swatch's share of its image, 0 to 1. */
54
56
  proportion: number;
@@ -63,16 +65,16 @@ export type PaintCatalogVariant = {
63
65
  variantId: string;
64
66
  variantName: string | null;
65
67
  };
66
- export type ResolvedColour = {
68
+ export type ResolvedColor = {
67
69
  catalogueVariant: PaintCatalogVariant | null;
68
70
  hex: string;
69
71
  index: number;
70
72
  /** `region`: a named meaning's own OKLCh bounds, kept — never collapsed to one hex. */
71
73
  kind: "point" | "region";
72
- /** Renormalised share, image-extracted colours only; else null. */
74
+ /** Renormalised share, image-extracted colors only; else null. */
73
75
  share: number | null;
74
76
  };
75
- export type ColourAlternative = {
77
+ export type ColorAlternative = {
76
78
  code?: string;
77
79
  hex: string;
78
80
  libraryId: string;
@@ -80,18 +82,22 @@ export type ColourAlternative = {
80
82
  name: string;
81
83
  query: string;
82
84
  };
83
- export type UnresolvedColour = {
84
- alternatives: ColourAlternative[];
85
+ export type UnresolvedColor = {
86
+ alternatives: ColorAlternative[];
85
87
  index: number;
86
88
  input: string | null;
87
89
  };
88
- export type ColourVariantMatch = {
90
+ export type ColorVariantMatch = {
91
+ /** Accepted primary specification type; null when unknown. */
92
+ productTypeId: string | null;
89
93
  brand: string;
90
94
  brandId: string;
91
- category: string;
95
+ category: string | null;
96
+ /** All original source category IDs in source order; empty when unknown. */
97
+ categories: string[];
92
98
  code: string | null;
93
- colours: ColourConditionReceipt[];
94
- /** Share of the request's colours this variant matched, 0 to 1. Never a probability. */
99
+ colors: ColorConditionReceipt[];
100
+ /** Share of the request's colors this variant matched, 0 to 1. Never a probability. */
95
101
  coverage: number;
96
102
  imageUrl: string | null;
97
103
  product: string;
@@ -99,7 +105,7 @@ export type ColourVariantMatch = {
99
105
  variantId: string;
100
106
  variantName: string;
101
107
  };
102
- export type ColourPageInfo = {
108
+ export type ColorPageInfo = {
103
109
  endCursor: string | null;
104
110
  hasNextPage: boolean;
105
111
  /**
@@ -112,21 +118,21 @@ export type ColourPageInfo = {
112
118
  poolTruncated: boolean;
113
119
  };
114
120
  type ContainsOrPaletteResult = {
115
- /** Colour-matched candidates dropped by `list_variants`' hard filters or eligibility. */
121
+ /** Color-matched candidates dropped by `list_variants`' hard filters or eligibility. */
116
122
  gatedOut: number;
117
- matches: ColourVariantMatch[];
118
- pageInfo: ColourPageInfo;
119
- resolvedColours: ResolvedColour[];
120
- unresolvedColours: UnresolvedColour[];
123
+ matches: ColorVariantMatch[];
124
+ pageInfo: ColorPageInfo;
125
+ resolvedColors: ResolvedColor[];
126
+ unresolvedColors: UnresolvedColor[];
121
127
  };
122
- export type FindVariantsByColourContainsResult = ContainsOrPaletteResult & {
128
+ export type FindVariantsByColorContainsResult = ContainsOrPaletteResult & {
123
129
  mode: "contains";
124
130
  };
125
- export type FindVariantsByColourPaletteResult = ContainsOrPaletteResult & {
131
+ export type FindVariantsByColorPaletteResult = ContainsOrPaletteResult & {
126
132
  mode: "palette";
127
133
  };
128
- /** `reference.candidates`/`reference.seed`'s shape — mirrors `compare-colour-similarity.ts`'s own seed, unlike `matches[]` below. */
129
- export type ColourRankedSeed = {
134
+ /** `reference.candidates`/`reference.seed`'s shape — mirrors `compare-color-similarity.ts`'s own seed, unlike `matches[]` below. */
135
+ export type ColorRankedSeed = {
130
136
  brand: string;
131
137
  brandSlug: string;
132
138
  color: string | null;
@@ -134,16 +140,16 @@ export type ColourRankedSeed = {
134
140
  product: string;
135
141
  productId: string;
136
142
  variantId: string;
137
- /** The variant's own name — paint colourway names live here (label contract). */
143
+ /** The variant's own name — paint colorway names live here (label contract). */
138
144
  variantName: string | null;
139
145
  };
140
- /** RERANK's own card — the same shape `ColourVariantMatch` above (`brandId`, `code`), plus its two ranking-only fields. */
141
- export type ColourRankMatch = {
146
+ /** RERANK's own card — the same shape `ColorVariantMatch` above (`brandId`, `code`), plus its two ranking-only fields. */
147
+ export type ColorRankMatch = {
142
148
  brand: string;
143
149
  brandId: string;
144
150
  code: string | null;
145
- /** Colour similarity in [0,1], 1 = identical palette; null when unembedded. */
146
- colourSimilarity: number | null;
151
+ /** Color similarity in [0,1], 1 = identical palette; null when unembedded. */
152
+ colorSimilarity: number | null;
147
153
  /** Cosine distance computed in TypeScript (0 = identical); null when unembedded. */
148
154
  distance: number | null;
149
155
  imageUrl: string | null;
@@ -152,19 +158,19 @@ export type ColourRankMatch = {
152
158
  variantId: string;
153
159
  variantName: string | null;
154
160
  };
155
- export type ResolvedColourReference = {
161
+ export type ResolvedColorReference = {
156
162
  hex: string;
157
163
  name: string | null;
158
164
  ref: string;
159
165
  };
160
- export type CompareColourSimilarityReference = {
166
+ export type CompareColorSimilarityReference = {
161
167
  /** Best-per-brand candidates when `resolution === "ambiguous"`; empty otherwise. */
162
- candidates: ColourRankedSeed[];
163
- /** The resolved colour when the reference was a `colour`, else null. */
164
- colour: ResolvedColourReference | null;
168
+ candidates: ColorRankedSeed[];
169
+ /** The resolved color when the reference was a `color`, else null. */
170
+ color: ResolvedColorReference | null;
165
171
  /** The input as given, so an agent can react to a miss. */
166
172
  input: {
167
- colour?: string;
173
+ color?: string;
168
174
  material?: string;
169
175
  oklab?: {
170
176
  L: number;
@@ -173,25 +179,25 @@ export type CompareColourSimilarityReference = {
173
179
  };
174
180
  variantId?: string;
175
181
  };
176
- /** `ambiguous` when a colour-name material reference spans several brands. */
182
+ /** `ambiguous` when a color-name material reference spans several brands. */
177
183
  resolution: "resolved" | "ambiguous";
178
184
  /** The resolved seed when the reference was a `material`/`variantId`, else null. */
179
- seed: ColourRankedSeed | null;
185
+ seed: ColorRankedSeed | null;
180
186
  };
181
- export type FindVariantsByColourRerankResult = {
187
+ export type FindVariantsByColorRerankResult = {
182
188
  /** Present ONLY when the request narrowed it. ABSENT means the whole graph. */
183
- corpusScope?: CorpusScopeReceipt;
184
- /** Real variant ids outside `corpusScope` or the materials catalogue. Present when a scope narrowed or any was excluded. */
185
- excludedByCorpusScope?: string[];
186
- /** Candidates ranked by ascending colour distance; unembedded ones last. */
187
- matches: ColourRankMatch[];
189
+ searchCatalogueSubset?: SearchCatalogueSubsetReceipt;
190
+ /** Real variant ids outside `searchCatalogueSubset` or the materials catalogue. Present when a scope narrowed or any was excluded. */
191
+ excludedBySearchCatalogueSubset?: string[];
192
+ /** Candidates ranked by ascending color distance; unembedded ones last. */
193
+ matches: ColorRankMatch[];
188
194
  mode: "rerank";
189
195
  /** The reference, echoed with its resolution. */
190
- reference: CompareColourSimilarityReference;
191
- /** The reference colour, echoed in the same shape CONTAINS/PALETTE use — always 0 or 1 entries. */
192
- resolvedColours: ResolvedColour[];
196
+ reference: CompareColorSimilarityReference;
197
+ /** The reference color, echoed in the same shape CONTAINS/PALETTE use — always 0 or 1 entries. */
198
+ resolvedColors: ResolvedColor[];
193
199
  /** Candidate ids that did not resolve to any variant. */
194
200
  unresolved: string[];
195
201
  };
196
- export type FindVariantsByColourOutput = FindVariantsByColourContainsResult | FindVariantsByColourPaletteResult | FindVariantsByColourRerankResult;
202
+ export type FindVariantsByColorOutput = FindVariantsByColorContainsResult | FindVariantsByColorPaletteResult | FindVariantsByColorRerankResult;
197
203
  export {};
@@ -8,6 +8,7 @@
8
8
  */
9
9
  import type { ImageReferenceInput } from "./image-reference-types.js";
10
10
  import type { FilterGroups, ListVariantsItem } from "./list-variants-types.js";
11
+ import type { SearchCatalogueSubset } from "./search-catalogue-subset-types.js";
11
12
  export declare const FIND_VARIANTS_BY_VECTOR_MODES: readonly ["text", "image", "text_and_image"];
12
13
  export type FindVariantsByVectorMode = (typeof FIND_VARIANTS_BY_VECTOR_MODES)[number];
13
14
  export type FindVariantsByVectorQuery = {
@@ -26,6 +27,8 @@ export type FindVariantsByVectorInput = {
26
27
  /** Default 20. */
27
28
  limit?: number;
28
29
  query: FindVariantsByVectorQuery;
30
+ /** Only this corpus scope. Absent or all: every variant. */
31
+ searchCatalogueSubset?: SearchCatalogueSubset;
29
32
  };
30
33
  export type FindVariantsByVectorItem = Omit<ListVariantsItem, "materialBankId"> & {
31
34
  /** The variant's Material Bank SKU; null means none is recorded. Always present here, unlike `list_variants`' optional field. */
@@ -54,7 +57,7 @@ export type FindVariantsByVectorTimings = {
54
57
  };
55
58
  export type FindVariantsByVectorOutput = {
56
59
  /** Explicit `{field: "variant", op: "in"}` filter ids that name a real variant outside the materials catalogue — present only when at least one did. */
57
- excludedByCorpusScope?: string[];
60
+ excludedBySearchCatalogueSubset?: string[];
58
61
  items: FindVariantsByVectorItem[];
59
62
  mode: FindVariantsByVectorMode;
60
63
  reference: FindVariantsByVectorReference;
@@ -7,7 +7,7 @@
7
7
  * `__tests__/contract-parity.test.ts` keeps the mirror honest against the
8
8
  * server types.
9
9
  */
10
- import type { ListVariantsNotApplicable, ListVariantsSpecifications } from "./list-variants-types.js";
10
+ import type { ListVariantsNotApplicable, ListVariantsSpecifications, SampleSubject } from "./list-variants-types.js";
11
11
  /** The detail to add under `specifications`; absent, the answer is the compact item alone. */
12
12
  export type GetVariantOptions = {
13
13
  /** Canonical attribute ids, e.g. `["nrc_rating"]`. */
@@ -24,7 +24,19 @@ export type GetVariantOutput = {
24
24
  category: {
25
25
  id: string;
26
26
  name: string;
27
- };
27
+ } | null;
28
+ categories: {
29
+ id: string;
30
+ name: string;
31
+ }[];
32
+ /** Null for a color sample or an unresolved subject. */
33
+ productType: {
34
+ id: string;
35
+ name: string;
36
+ } | null;
37
+ sampleSubject: SampleSubject;
38
+ /** The represented library color; null when none is established. */
39
+ colorOptionValueId: string | null;
28
40
  code: string | null;
29
41
  image: {
30
42
  alt: string;
@@ -13,7 +13,7 @@ export type RequestOptions = {
13
13
  export type StreamRequestOptions = {
14
14
  /** The streaming media type to negotiate (`text/event-stream`, `application/x-ndjson`). */
15
15
  accept: string;
16
- /** Names this stream in the "returned no body" diagnostic, e.g. `"match stream"`. */
16
+ /** Names this stream in the "returned no body" diagnostic, e.g. `"run-event stream"`. */
17
17
  subject: string;
18
18
  } & RequestOptions;
19
19
  /** A read, status-checked HTTP response with its parsed body. */
package/http-transport.js CHANGED
@@ -2,8 +2,7 @@
2
2
  * The shared low-level HTTP transport for {@link MaterialGraphClient}. It owns
3
3
  * URL building, the bearer header, rate-limit capture, response reading, and the
4
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
5
+ * upload, and the SSE stream (`runs.ts`) all fail identically. Retry-free by design; a single
7
6
  * failure surfaces as one {@link MaterialGraphError}.
8
7
  */
9
8
  import { MaterialGraphError } from "./errors.js";
package/identifiers.d.ts CHANGED
@@ -16,7 +16,7 @@
16
16
  * `categoryKey`, `jurisdictionId`, `brandSlug`. These ARE meaningful, stable,
17
17
  * and yours to compose queries from — but you DISCOVER them rather than
18
18
  * invent them (`listVariantFacets()`, `listEnumValues()`,
19
- * `listAttributes()`, `taxonomy()`, `colourFacets()`, `codes.context()`).
19
+ * `listAttributes()`, `categories.list()`, `brands()`).
20
20
  * A hand-guessed canonical token is the second-most-common caller bug.
21
21
  *
22
22
  * Every alias below is exactly `string`. They carry no runtime weight and no
@@ -30,7 +30,7 @@
30
30
  export type OpaqueId = string;
31
31
  /**
32
32
  * A variant id — the identity of ONE buyable material (this product in this
33
- * colourway/finish). The unit almost every read is keyed on.
33
+ * colorway/finish). The unit almost every read is keyed on.
34
34
  *
35
35
  * Opaque: preserve verbatim, never parse or construct one.
36
36
  */
package/identifiers.js CHANGED
@@ -16,7 +16,7 @@
16
16
  * `categoryKey`, `jurisdictionId`, `brandSlug`. These ARE meaningful, stable,
17
17
  * and yours to compose queries from — but you DISCOVER them rather than
18
18
  * invent them (`listVariantFacets()`, `listEnumValues()`,
19
- * `listAttributes()`, `taxonomy()`, `colourFacets()`, `codes.context()`).
19
+ * `listAttributes()`, `categories.list()`, `brands()`).
20
20
  * A hand-guessed canonical token is the second-most-common caller bug.
21
21
  *
22
22
  * Every alias below is exactly `string`. They carry no runtime weight and no
package/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export type * from "./list-enum-values-types.js";
7
7
  export type * from "./get-variant-types.js";
8
8
  export type * from "./image-reference-types.js";
9
9
  export type * from "./find-companions-types.js";
10
- export type * from "./find-variants-by-colour-types.js";
10
+ export type * from "./find-variants-by-color-types.js";
11
11
  export { FIND_VARIANTS_BY_VECTOR_MODES } from "./find-variants-by-vector-types.js";
12
12
  export type * from "./find-variants-by-vector-types.js";
13
13
  export { MATERIALGRAPH_API_VERSION, SDK_OPERATIONS } from "./operations.js";
@@ -19,25 +19,16 @@ export type * from "./citation-types.js";
19
19
  export { MATERIALGRAPH_PROBLEM_EXTENSIONS, MaterialGraphError, } from "./errors.js";
20
20
  export type { MaterialGraphErrorInit, MaterialGraphErrorKind, MaterialGraphRequestMetadata, ProblemDetail, RateLimit, SanitizedErrorValue, SanitizedIssue, SimpleErrorBody, } from "./errors.js";
21
21
  export type * from "./types.js";
22
- export type * from "./search-card-types.js";
23
22
  export type * from "./resolve-variant-types.js";
24
23
  export type * from "./catalogue-types.js";
25
- export type * from "./by-colour-types.js";
26
24
  export { CategoriesClient } from "./categories-client.js";
27
25
  export type * from "./category-types.js";
28
- export { ColoursClient } from "./colours-client.js";
29
- export type { ColoursTransport } from "./colours-client.js";
30
- export type * from "./palette-search-types.js";
31
- export type * from "./query-understanding-types.js";
32
- export type * from "./material-query-plan-types.js";
26
+ export { ColorsClient } from "./colors-client.js";
27
+ export type { ColorsTransport } from "./colors-client.js";
28
+ export type * from "./color-profiles-types.js";
33
29
  export type * from "./association-types.js";
34
30
  export type * from "./brand-types.js";
35
31
  export type * from "./material-asset-types.js";
36
32
  export type * from "./material-block-types.js";
37
33
  export type * from "./schema-resource-types.js";
38
- export type * from "./search-refinement-types.js";
39
- export type * from "./attribution-types.js";
40
- export { CERTIFICATION_PROGRAMME_ATTRIBUTE_ID } from "./spec-types.js";
41
- export type * from "./spec-types.js";
42
- export { certificationProgramme, hasSpec, specTerm } from "./specifications.js";
43
34
  export type { SamplizePublicationSource, SamplizeLrvObservation, SamplizeDemand, SamplizeCollectionMembership, SamplizeCatalogueOptions, SamplizeCataloguePage, SamplizeCatalogueProduct, SamplizeHexObservation, } from "./samplize-catalogue-types.js";
package/index.js CHANGED
@@ -4,6 +4,4 @@ export { MATERIALGRAPH_API_VERSION, SDK_OPERATIONS } from "./operations.js";
4
4
  export { TERMINAL_RUN_EVENT_TYPES } from "./run-types.js";
5
5
  export { MATERIALGRAPH_PROBLEM_EXTENSIONS, MaterialGraphError, } from "./errors.js";
6
6
  export { CategoriesClient } from "./categories-client.js";
7
- export { ColoursClient } from "./colours-client.js";
8
- export { CERTIFICATION_PROGRAMME_ATTRIBUTE_ID } from "./spec-types.js";
9
- export { certificationProgramme, hasSpec, specTerm } from "./specifications.js";
7
+ export { ColorsClient } from "./colors-client.js";
@@ -1,3 +1,4 @@
1
+ import type { FilterGroups } from "./list-variants-types.js";
1
2
  /**
2
3
  * @module list-variant-facets-types
3
4
  * @description Hand-maintained mirror of `list_variant_facets`'s (MG-2294)
@@ -7,14 +8,13 @@
7
8
  * dependency on `@materialgraph/products`, so the shapes are copied here and
8
9
  * `contract-parity.test.ts` keeps them honest.
9
10
  */
10
- import type { CorpusScope } from "./corpus-scope-types.js";
11
- import type { FilterGroups } from "./list-variants-types.js";
11
+ import type { SearchCatalogueSubset } from "./search-catalogue-subset-types.js";
12
12
  export type ListVariantFacetsInput = {
13
- /** 1–10 facetable attribute ids. Find them with `listAttributes()`. */
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
- corpusScope?: CorpusScope;
17
+ searchCatalogueSubset?: SearchCatalogueSubset;
18
18
  filters?: FilterGroups;
19
19
  /** Top values per categorical or boolean facet, 1–50. Defaults to 10. */
20
20
  valuesPerFacet?: number;
@@ -9,11 +9,22 @@
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 { CorpusScope } from "./corpus-scope-types.js";
12
+ import type { SearchCatalogueSubset } from "./search-catalogue-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;
16
16
  op: "in" | "all" | "not_in";
17
+ /**
18
+ * Meets the condition when the value is stated OR this phrase appears in the
19
+ * variant's text. One to 100 characters, on an `in` or `all` only, never a
20
+ * `not_in`. Term attributes only. Absent: the value must be stated.
21
+ */
22
+ orText?: string;
23
+ /**
24
+ * `"pass"` on a `not_in` lets the variants that do not state the attribute
25
+ * at all through. Absent: a variant must state the attribute to pass.
26
+ */
27
+ unstated?: "pass";
17
28
  values: string[];
18
29
  };
19
30
  export type FilterNumericCondition = {
@@ -34,6 +45,17 @@ export type FilterPresenceCondition = {
34
45
  export type FilterAnyFieldCondition = {
35
46
  fields: string[];
36
47
  op: "in" | "not_in";
48
+ /**
49
+ * Meets the condition when the value is stated OR this phrase appears in the
50
+ * variant's text. One to 100 characters, on an `in` only, never a `not_in`.
51
+ * Absent: the value must be stated.
52
+ */
53
+ orText?: string;
54
+ /**
55
+ * `"pass"` on a `not_in` lets the variants that state none of the fields
56
+ * through. Absent: at least one field must be stated.
57
+ */
58
+ unstated?: "pass";
37
59
  values: string[];
38
60
  };
39
61
  /**
@@ -54,9 +76,9 @@ export type FilterGroups = {
54
76
  presence?: FilterPresenceCondition[];
55
77
  anyField?: FilterAnyFieldCondition[];
56
78
  };
57
- /** `optionalFilters`: the same kind-grouped shape as `filters`, with every entry also carrying a required `weight` (1–10). Ranks matched items; never excludes. */
79
+ /** `optionalFilters`: the same kind-grouped shape as `filters` but for `unstated`, with every entry also carrying a required `weight` (1–10). Ranks matched items; never excludes. */
58
80
  export type OptionalFilterGroups = {
59
- terms?: (FilterTermCondition & {
81
+ terms?: (Omit<FilterTermCondition, "unstated"> & {
60
82
  weight: number;
61
83
  })[];
62
84
  numbers?: (FilterNumericCondition & {
@@ -65,7 +87,7 @@ export type OptionalFilterGroups = {
65
87
  presence?: (FilterPresenceCondition & {
66
88
  weight: number;
67
89
  })[];
68
- anyField?: (FilterAnyFieldCondition & {
90
+ anyField?: (Omit<FilterAnyFieldCondition, "unstated"> & {
69
91
  weight: number;
70
92
  })[];
71
93
  };
@@ -75,42 +97,42 @@ export type OrderByEntry = {
75
97
  field: string;
76
98
  };
77
99
  export type ListVariantsInclude = "image" | "url";
78
- export type ListVariantsCollapse = "product" | "colourway";
100
+ export type ListVariantsCollapse = "product" | "colorway";
79
101
  /** A region in OKLCh: lightness and chroma as bounds, hue an arc in degrees that wraps when its start is past its end, null for any hue. */
80
- export type ColourRegion = {
102
+ export type ColorRegion = {
81
103
  chroma: [number, number];
82
104
  hue: [number, number] | null;
83
105
  lightness: [number, number];
84
106
  };
85
107
  /**
86
- * A measured-colour condition. `in` keeps a variant with a large swatch inside
108
+ * A measured-color condition. `in` keeps a variant with a large swatch inside
87
109
  * `range`; `not_in` leaves those out and lets a variant with no measured
88
- * colour pass. `preferred` only orders and never narrows.
110
+ * color pass. `preferred` only orders and never narrows.
89
111
  */
90
- export type ColourRangeCondition = {
91
- /** The colour's own point in the region, `#rrggbb`; it orders matches, nearest first. */
112
+ export type ColorRangeCondition = {
113
+ /** The color's own point in the region, `#rrggbb`; it orders matches, nearest first. */
92
114
  hex: string;
93
115
  intent?: "required" | "preferred";
94
116
  op: "in" | "not_in";
95
- range: ColourRegion;
117
+ range: ColorRegion;
96
118
  };
97
119
  export type ListVariantsInput = {
98
120
  /** Attribute ids to project under each item's `specifications`. */
99
121
  attributes?: string[];
100
122
  /**
101
- * `product`: one row per product, its lead colourway by the page's order,
102
- * with `variantCount` saying how many colourways stand behind it. The
103
- * cursor pages products. `colourway`: one row per colourway, so a colour
123
+ * `product`: one row per product, its lead colorway by the page's order,
124
+ * with `variantCount` saying how many colorways stand behind it. The
125
+ * cursor pages products. `colorway`: one row per colorway, so a color
104
126
  * sold on several substrates is one row.
105
127
  */
106
128
  collapse?: ListVariantsCollapse;
107
- /** Up to four measured-colour regions. */
108
- colours?: ColourRangeCondition[];
129
+ /** Up to four measured-color regions. */
130
+ colors?: ColorRangeCondition[];
109
131
  /**
110
132
  * Only variants in this corpus scope: the rows, the page and the cursor.
111
133
  * Absent or `all` is every variant.
112
134
  */
113
- corpusScope?: CorpusScope;
135
+ searchCatalogueSubset?: SearchCatalogueSubset;
114
136
  cursor?: string;
115
137
  /** Every condition, across `terms`/`numbers`/`presence`/`anyField`, must match. */
116
138
  filters?: FilterGroups;
@@ -144,15 +166,36 @@ export type ListVariantsNotApplicable = {
144
166
  attributes?: string[];
145
167
  blocks?: string[];
146
168
  };
169
+ /** What a sample represents, independently of its specification type. */
170
+ export type SampleSubject = "material" | "paint_color_sample" | "unknown" | "conflict";
147
171
  /**
148
172
  * One list item: the compact identity needed to pick a variant, with image
149
173
  * and brand page only when requested (`include`) and selected attributes
150
174
  * under `specifications`. Leaner than `get_variant`'s item on purpose.
151
175
  */
152
176
  export type ListVariantsItem = {
153
- category: string;
177
+ category: {
178
+ id: string;
179
+ name: string;
180
+ } | null;
181
+ categories: {
182
+ id: string;
183
+ name: string;
184
+ }[];
185
+ /** Null for a color sample or an unresolved subject. */
186
+ productType: {
187
+ id: string;
188
+ name: string;
189
+ } | null;
190
+ sampleSubject: SampleSubject;
191
+ /** The represented library color; null when none is established. */
192
+ colorOptionValueId: string | null;
154
193
  code: string | null;
155
- image?: string | null;
194
+ /** Present only when `include` has `image`. */
195
+ image?: {
196
+ alt: string;
197
+ url: string;
198
+ } | null;
156
199
  brand: {
157
200
  id: string;
158
201
  name: string;
@@ -177,7 +220,7 @@ export type ListVariantsItem = {
177
220
  };
178
221
  export type ListVariantsOutput = {
179
222
  /** Explicit `{field: "variant", op: "in"}` ids that name a real variant outside the materials catalogue. Present only when at least one did. */
180
- excludedByCorpusScope?: string[];
223
+ excludedBySearchCatalogueSubset?: string[];
181
224
  items: ListVariantsItem[];
182
225
  pageInfo: {
183
226
  endCursor: string | null;
@@ -185,8 +228,15 @@ export type ListVariantsOutput = {
185
228
  };
186
229
  /** False: nothing from this page on meets any `optionalFilters` entry. Absent when not measured. */
187
230
  preferenceMatchesRemain?: boolean;
188
- /** Explicit `{field: "variant", op: "in"}` ids anywhere in `filters.terms` that did not resolve to an eligible variant in the requested `corpusScope`. */
231
+ /** Explicit `{field: "variant", op: "in"}` ids that name a variant in the materials catalogue that this list cannot show in the requested `searchCatalogueSubset`: retired, not orderable, or outside the scope. Read one with `getVariant`. Present only when at least one did. */
232
+ unavailableVariantIds?: string[];
233
+ /** Explicit `{field: "variant", op: "in"}` ids anywhere in `filters.terms` that name no variant at all. */
189
234
  unresolvedVariantIds?: string[];
190
235
  /** Filtered attributes no variant in scope states at all. Present only on an empty first page, so its absence means the empty page is a genuine no-match. */
191
236
  unstated?: string[];
237
+ /** Each requested word and whether any variant in scope names it. */
238
+ words?: {
239
+ matched: boolean;
240
+ word: string;
241
+ }[];
192
242
  };
@@ -17,11 +17,11 @@ import type { OpenEnum } from "./types.js";
17
17
  */
18
18
  export type VariantAssetAvailability = OpenEnum<"available" | "unknown" | "unavailable">;
19
19
  /** What an image primarily shows. */
20
- export type VariantImageRole = OpenEnum<"product" | "swatch" | "detail" | "scene" | "technical" | "colour_chart" | "sample_collection" | "other" | "unknown">;
20
+ export type VariantImageRole = OpenEnum<"product" | "swatch" | "detail" | "scene" | "technical" | "color_chart" | "sample_collection" | "other" | "unknown">;
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" | "catalogue" | "colour_finish_chart" | "other" | "unknown">;
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" | "catalogue" | "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
  /**
@@ -97,7 +97,7 @@ export type MaterialDocumentProjectionItem = {
97
97
  variantAttribution: string[];
98
98
  /** True only for a Product declaration or this exact requested Variant. */
99
99
  appliesToRequestedVariant: boolean;
100
- /** Every exact source-grain declaration collapsed into this URL identity. */
100
+ /** Every exact source-default attribute level declaration collapsed into this URL identity. */
101
101
  declarations: {
102
102
  scope: MaterialDocumentScope;
103
103
  source: MaterialDocumentSource;