@instruments/materialgraph 0.32.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 +2 -3
  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 +75 -102
  20. package/client.js +83 -100
  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 +5 -13
  33. package/index.js +1 -3
  34. package/list-variant-facets-types.d.ts +4 -4
  35. package/list-variants-types.d.ts +108 -19
  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 +14 -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 +40 -68
  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 +91 -0
  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/palette-search-types.d.ts +0 -171
  60. package/palette-search-types.js +0 -1
  61. package/query-understanding-types.d.ts +0 -254
  62. package/query-understanding-types.js +0 -1
  63. package/resolve-colour-types.js +0 -1
  64. package/search-card-types.d.ts +0 -86
  65. package/search-card-types.js +0 -1
  66. package/search-index-plan-types.d.ts +0 -74
  67. package/search-index-plan-types.js +0 -1
  68. package/search-refinement-types.d.ts +0 -103
  69. package/search-refinement-types.js +0 -2
  70. package/search-request-types.d.ts +0 -170
  71. package/search-request-types.js +0 -1
  72. package/search-response-receipt-types.d.ts +0 -24
  73. package/search-response-receipt-types.js +0 -1
  74. package/search-response-types.d.ts +0 -11
  75. package/search-response-types.js +0 -1
  76. package/search-result-validation.d.ts +0 -9
  77. package/search-result-validation.js +0 -83
  78. package/spec-types.d.ts +0 -109
  79. package/spec-types.js +0 -54
  80. package/specifications.d.ts +0 -34
  81. package/specifications.js +0 -56
  82. package/validation.d.ts +0 -43
  83. package/validation.js +0 -117
  84. /package/{by-colour-types.js → color-profiles-types.js} +0 -0
  85. /package/{colour-region-types.js → find-variants-by-color-types.js} +0 -0
  86. /package/{corpus-scope-types.js → resolve-color-types.js} +0 -0
  87. /package/{find-variants-by-colour-types.js → search-catalogue-subset-types.js} +0 -0
  88. /package/{material-query-plan-types.js → search-variants-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
@@ -2,11 +2,12 @@ export { MaterialGraphClient, DEFAULT_BASE_URL } from "./client.js";
2
2
  export type { MaterialGraphClientOptions } from "./client.js";
3
3
  export type * from "./list-variants-types.js";
4
4
  export type * from "./list-variant-facets-types.js";
5
+ export type * from "./search-variants-types.js";
5
6
  export type * from "./list-enum-values-types.js";
6
7
  export type * from "./get-variant-types.js";
7
8
  export type * from "./image-reference-types.js";
8
9
  export type * from "./find-companions-types.js";
9
- export type * from "./find-variants-by-colour-types.js";
10
+ export type * from "./find-variants-by-color-types.js";
10
11
  export { FIND_VARIANTS_BY_VECTOR_MODES } from "./find-variants-by-vector-types.js";
11
12
  export type * from "./find-variants-by-vector-types.js";
12
13
  export { MATERIALGRAPH_API_VERSION, SDK_OPERATIONS } from "./operations.js";
@@ -18,25 +19,16 @@ export type * from "./citation-types.js";
18
19
  export { MATERIALGRAPH_PROBLEM_EXTENSIONS, MaterialGraphError, } from "./errors.js";
19
20
  export type { MaterialGraphErrorInit, MaterialGraphErrorKind, MaterialGraphRequestMetadata, ProblemDetail, RateLimit, SanitizedErrorValue, SanitizedIssue, SimpleErrorBody, } from "./errors.js";
20
21
  export type * from "./types.js";
21
- export type * from "./search-card-types.js";
22
22
  export type * from "./resolve-variant-types.js";
23
23
  export type * from "./catalogue-types.js";
24
- export type * from "./by-colour-types.js";
25
24
  export { CategoriesClient } from "./categories-client.js";
26
25
  export type * from "./category-types.js";
27
- export { ColoursClient } from "./colours-client.js";
28
- export type { ColoursTransport } from "./colours-client.js";
29
- export type * from "./palette-search-types.js";
30
- export type * from "./query-understanding-types.js";
31
- 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";
32
29
  export type * from "./association-types.js";
33
30
  export type * from "./brand-types.js";
34
31
  export type * from "./material-asset-types.js";
35
32
  export type * from "./material-block-types.js";
36
33
  export type * from "./schema-resource-types.js";
37
- export type * from "./search-refinement-types.js";
38
- export type * from "./attribution-types.js";
39
- export { CERTIFICATION_PROGRAMME_ATTRIBUTE_ID } from "./spec-types.js";
40
- export type * from "./spec-types.js";
41
- export { certificationProgramme, hasSpec, specTerm } from "./specifications.js";
42
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 = {
@@ -26,24 +37,48 @@ export type FilterPresenceCondition = {
26
37
  op: "exists" | "missing";
27
38
  };
28
39
  /**
29
- * One filter condition, whichever of the three fully-required shapes. No
40
+ * A term stated under ANY of `fields` (2–8 distinct term attributes), for a
41
+ * concept stored under several of them. `in`: at least one of `values` under
42
+ * at least one field. `not_in`: at least one field stated at all, and none of
43
+ * `values` under any field.
44
+ */
45
+ export type FilterAnyFieldCondition = {
46
+ fields: string[];
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";
59
+ values: string[];
60
+ };
61
+ /**
62
+ * One filter condition, whichever of the four fully-required shapes. No
30
63
  * `unit` key (a numeric value is in the attribute's own canonical unit).
31
64
  */
32
- export type FilterCondition = FilterTermCondition | FilterNumericCondition | FilterPresenceCondition;
65
+ export type FilterCondition = FilterTermCondition | FilterNumericCondition | FilterPresenceCondition | FilterAnyFieldCondition;
33
66
  /**
34
67
  * `filters`: kind-grouped, not a flat list (MG-2222) — `{terms, numbers,
35
- * presence}`. Every condition across all three arrays must match (AND); OR
36
- * within one field is `in`. Send only the arrays you need; an omitted or
37
- * empty array carries no conditions.
68
+ * presence, anyField}`. Every condition across all four arrays must match
69
+ * (AND); OR within one field is `in`, and `anyField` is OR across several
70
+ * fields. Send only the arrays you need; an omitted or empty array carries no
71
+ * conditions.
38
72
  */
39
73
  export type FilterGroups = {
40
74
  terms?: FilterTermCondition[];
41
75
  numbers?: FilterNumericCondition[];
42
76
  presence?: FilterPresenceCondition[];
77
+ anyField?: FilterAnyFieldCondition[];
43
78
  };
44
- /** `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. */
45
80
  export type OptionalFilterGroups = {
46
- terms?: (FilterTermCondition & {
81
+ terms?: (Omit<FilterTermCondition, "unstated"> & {
47
82
  weight: number;
48
83
  })[];
49
84
  numbers?: (FilterNumericCondition & {
@@ -52,6 +87,9 @@ export type OptionalFilterGroups = {
52
87
  presence?: (FilterPresenceCondition & {
53
88
  weight: number;
54
89
  })[];
90
+ anyField?: (Omit<FilterAnyFieldCondition, "unstated"> & {
91
+ weight: number;
92
+ })[];
55
93
  };
56
94
  export type OrderByEntry = {
57
95
  direction: "asc" | "desc";
@@ -59,23 +97,44 @@ export type OrderByEntry = {
59
97
  field: string;
60
98
  };
61
99
  export type ListVariantsInclude = "image" | "url";
62
- export type ListVariantsCollapse = "product";
100
+ export type ListVariantsCollapse = "product" | "colorway";
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. */
102
+ export type ColorRegion = {
103
+ chroma: [number, number];
104
+ hue: [number, number] | null;
105
+ lightness: [number, number];
106
+ };
107
+ /**
108
+ * A measured-color condition. `in` keeps a variant with a large swatch inside
109
+ * `range`; `not_in` leaves those out and lets a variant with no measured
110
+ * color pass. `preferred` only orders and never narrows.
111
+ */
112
+ export type ColorRangeCondition = {
113
+ /** The color's own point in the region, `#rrggbb`; it orders matches, nearest first. */
114
+ hex: string;
115
+ intent?: "required" | "preferred";
116
+ op: "in" | "not_in";
117
+ range: ColorRegion;
118
+ };
63
119
  export type ListVariantsInput = {
64
120
  /** Attribute ids to project under each item's `specifications`. */
65
121
  attributes?: string[];
66
122
  /**
67
- * `product`: one row per product, its lead colourway by the page's order,
68
- * with `variantCount` saying how many colourways stand behind it. The
69
- * cursor pages products.
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
126
+ * sold on several substrates is one row.
70
127
  */
71
128
  collapse?: ListVariantsCollapse;
129
+ /** Up to four measured-color regions. */
130
+ colors?: ColorRangeCondition[];
72
131
  /**
73
132
  * Only variants in this corpus scope: the rows, the page and the cursor.
74
133
  * Absent or `all` is every variant.
75
134
  */
76
- corpusScope?: CorpusScope;
135
+ searchCatalogueSubset?: SearchCatalogueSubset;
77
136
  cursor?: string;
78
- /** Every condition, across `terms`/`numbers`/`presence`, must match. */
137
+ /** Every condition, across `terms`/`numbers`/`presence`/`anyField`, must match. */
79
138
  filters?: FilterGroups;
80
139
  include?: ListVariantsInclude[];
81
140
  /** 1–50; defaults to 10. */
@@ -89,10 +148,12 @@ export type ListVariantsInput = {
89
148
  /** Rank only — never excludes. */
90
149
  optionalFilters?: OptionalFilterGroups;
91
150
  orderBy?: OrderByEntry[];
151
+ /** Words each variant must name in its text, inside the filters. */
152
+ words?: string[];
92
153
  };
93
154
  /**
94
155
  * `score` sums the weights of the matched `optionalFilters`; `matched` lists
95
- * their positions in the flattened terms-then-numbers-then-presence order
156
+ * their positions in the flattened terms-then-numbers-then-presence-then-anyField order
96
157
  * the server reads `optionalFilters` in, not the caller's own array shape.
97
158
  */
98
159
  export type ListVariantsPreference = {
@@ -105,15 +166,36 @@ export type ListVariantsNotApplicable = {
105
166
  attributes?: string[];
106
167
  blocks?: string[];
107
168
  };
169
+ /** What a sample represents, independently of its specification type. */
170
+ export type SampleSubject = "material" | "paint_color_sample" | "unknown" | "conflict";
108
171
  /**
109
172
  * One list item: the compact identity needed to pick a variant, with image
110
173
  * and brand page only when requested (`include`) and selected attributes
111
174
  * under `specifications`. Leaner than `get_variant`'s item on purpose.
112
175
  */
113
176
  export type ListVariantsItem = {
114
- 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;
115
193
  code: string | null;
116
- image?: string | null;
194
+ /** Present only when `include` has `image`. */
195
+ image?: {
196
+ alt: string;
197
+ url: string;
198
+ } | null;
117
199
  brand: {
118
200
  id: string;
119
201
  name: string;
@@ -138,7 +220,7 @@ export type ListVariantsItem = {
138
220
  };
139
221
  export type ListVariantsOutput = {
140
222
  /** Explicit `{field: "variant", op: "in"}` ids that name a real variant outside the materials catalogue. Present only when at least one did. */
141
- excludedByCorpusScope?: string[];
223
+ excludedBySearchCatalogueSubset?: string[];
142
224
  items: ListVariantsItem[];
143
225
  pageInfo: {
144
226
  endCursor: string | null;
@@ -146,8 +228,15 @@ export type ListVariantsOutput = {
146
228
  };
147
229
  /** False: nothing from this page on meets any `optionalFilters` entry. Absent when not measured. */
148
230
  preferenceMatchesRemain?: boolean;
149
- /** 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. */
150
234
  unresolvedVariantIds?: string[];
151
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. */
152
236
  unstated?: string[];
237
+ /** Each requested word and whether any variant in scope names it. */
238
+ words?: {
239
+ matched: boolean;
240
+ word: string;
241
+ }[];
153
242
  };