@instruments/materialgraph 0.25.0 → 0.27.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 (158) hide show
  1. package/association-types.d.ts +38 -27
  2. package/associations-client.d.ts +4 -4
  3. package/associations-client.js +3 -10
  4. package/attribution-types.d.ts +4 -4
  5. package/brand-types.d.ts +14 -6
  6. package/brands-client.d.ts +7 -38
  7. package/brands-client.js +10 -40
  8. package/by-colour-types.d.ts +58 -31
  9. package/by-spec-types.d.ts +6 -73
  10. package/by-spec-types.js +7 -5
  11. package/catalog-discovery-types.d.ts +11 -26
  12. package/catalogue-client.d.ts +16 -35
  13. package/catalogue-client.js +32 -67
  14. package/catalogue-types.d.ts +44 -4
  15. package/categories-client.d.ts +63 -0
  16. package/categories-client.js +48 -0
  17. package/category-types.d.ts +114 -0
  18. package/citation-types.d.ts +4 -4
  19. package/client-config.d.ts +4 -6
  20. package/client-config.js +2 -4
  21. package/client-source-material-comments.d.ts +4 -4
  22. package/client-source-material-comments.js +4 -38
  23. package/client-vocabulary.d.ts +7 -9
  24. package/client-vocabulary.js +22 -30
  25. package/client.d.ts +110 -244
  26. package/client.js +217 -387
  27. package/codes-client.d.ts +2 -2
  28. package/codes-client.js +8 -8
  29. package/codes-types.d.ts +55 -34
  30. package/colour-aggregate-types.d.ts +24 -24
  31. package/colours-client.d.ts +6 -11
  32. package/colours-client.js +11 -19
  33. package/coordinate-client.d.ts +2 -2
  34. package/coordinate-client.js +1 -13
  35. package/corpus-scope-types.d.ts +3 -3
  36. package/corpus-scope-types.js +1 -25
  37. package/demand-batch-types.d.ts +18 -18
  38. package/demand-types.d.ts +24 -24
  39. package/errors.d.ts +13 -13
  40. package/errors.js +54 -52
  41. package/http-transport.d.ts +13 -21
  42. package/http-transport.js +31 -28
  43. package/identify-types.d.ts +54 -44
  44. package/identify-types.js +5 -3
  45. package/index.d.ts +11 -27
  46. package/index.js +4 -6
  47. package/list-variant-facets-types.d.ts +60 -0
  48. package/list-variants-types.d.ts +142 -0
  49. package/list-variants-types.js +12 -0
  50. package/match-stream-types.d.ts +45 -32
  51. package/match-stream-types.js +2 -0
  52. package/match-stream.d.ts +2 -2
  53. package/match-stream.js +67 -49
  54. package/match-types.d.ts +32 -8
  55. package/material-asset-types.d.ts +89 -69
  56. package/material-block-types.d.ts +8 -6
  57. package/material-composition-client.d.ts +21 -0
  58. package/material-composition-client.js +13 -0
  59. package/material-composition-types.d.ts +403 -0
  60. package/material-query-plan-types.d.ts +61 -145
  61. package/material-resources-client.d.ts +12 -10
  62. package/material-resources-client.js +27 -22
  63. package/material-types.d.ts +16 -24
  64. package/ndjson.js +16 -8
  65. package/operations.d.ts +6 -6
  66. package/operations.js +29 -156
  67. package/package.json +5 -1
  68. package/palette-search-types.d.ts +87 -52
  69. package/query-understanding-types.d.ts +65 -40
  70. package/resolve-client.d.ts +8 -12
  71. package/resolve-client.js +9 -13
  72. package/resolve-colour-types.d.ts +8 -8
  73. package/resolve-types.d.ts +10 -10
  74. package/response-schemas.d.ts +20 -0
  75. package/response-schemas.generated.d.ts +5 -0
  76. package/response-schemas.generated.js +160 -0
  77. package/response-schemas.js +113 -0
  78. package/run-types.d.ts +64 -145
  79. package/runs.d.ts +9 -58
  80. package/runs.js +60 -149
  81. package/samplize-catalogue-types.d.ts +18 -18
  82. package/samplize-colorvec.d.ts +20 -20
  83. package/samplize-colorvec.js +66 -42
  84. package/schema-resource-types.d.ts +52 -39
  85. package/schema-resource-types.js +5 -5
  86. package/search-card-types.d.ts +26 -4
  87. package/search-index-plan-types.d.ts +70 -0
  88. package/search-refinement-types.d.ts +10 -40
  89. package/search-refinement-types.js +1 -0
  90. package/search-request-types.d.ts +121 -204
  91. package/search-response-receipt-types.d.ts +13 -253
  92. package/search-response-types.d.ts +2 -2
  93. package/search-result-validation.d.ts +3 -19
  94. package/search-result-validation.js +42 -183
  95. package/source-material-validation.d.ts +3 -3
  96. package/source-material-validation.js +35 -39
  97. package/spec-facet-types.d.ts +11 -16
  98. package/spec-types.d.ts +23 -16
  99. package/spec-types.js +8 -7
  100. package/specifications.d.ts +14 -72
  101. package/specifications.js +39 -89
  102. package/sse.d.ts +2 -2
  103. package/sse.js +32 -16
  104. package/substitute-types.d.ts +22 -22
  105. package/suggest-types.d.ts +11 -17
  106. package/suggest-types.js +3 -3
  107. package/taxonomy-coverage-types.d.ts +8 -8
  108. package/types.d.ts +202 -405
  109. package/validation.d.ts +26 -26
  110. package/validation.js +97 -92
  111. package/webmcp.d.ts +3 -3
  112. package/webmcp.generated.js +10 -93
  113. package/brand-most-sampled-types.d.ts +0 -33
  114. package/browse-types.d.ts +0 -236
  115. package/client-browse.d.ts +0 -78
  116. package/client-browse.js +0 -72
  117. package/client-exploration.d.ts +0 -9
  118. package/client-exploration.js +0 -7
  119. package/compare-types.d.ts +0 -89
  120. package/composition-client.d.ts +0 -33
  121. package/composition-client.js +0 -27
  122. package/composition-types.d.ts +0 -455
  123. package/composition-types.js +0 -10
  124. package/correction-types.d.ts +0 -88
  125. package/exploration-types.d.ts +0 -118
  126. package/exploration-types.js +0 -1
  127. package/fan-deck-types.d.ts +0 -42
  128. package/fan-deck-types.js +0 -9
  129. package/match-rejection-types.d.ts +0 -43
  130. package/match-rejection-types.js +0 -7
  131. package/palette-completion-types.d.ts +0 -115
  132. package/palette-completion-types.js +0 -1
  133. package/project-types.d.ts +0 -79
  134. package/project-types.js +0 -9
  135. package/projects.d.ts +0 -13
  136. package/projects.js +0 -46
  137. package/render-assets-types.d.ts +0 -65
  138. package/render-assets-types.js +0 -1
  139. package/run-events.d.ts +0 -106
  140. package/run-events.js +0 -32
  141. package/schedule-reference-types.d.ts +0 -46
  142. package/schedule-reference-types.js +0 -1
  143. package/schedule-references-client.d.ts +0 -14
  144. package/schedule-references-client.js +0 -26
  145. package/schedule-types.d.ts +0 -261
  146. package/schedule-types.js +0 -1
  147. package/search-collapse-types.d.ts +0 -69
  148. package/search-collapse-types.js +0 -1
  149. package/search-mood-types.d.ts +0 -6
  150. package/search-mood-types.js +0 -1
  151. package/search-window-types.d.ts +0 -25
  152. package/search-window-types.js +0 -1
  153. package/slot-pool-types.d.ts +0 -372
  154. package/slot-pool-types.js +0 -1
  155. /package/{brand-most-sampled-types.js → category-types.js} +0 -0
  156. /package/{browse-types.js → list-variant-facets-types.js} +0 -0
  157. /package/{compare-types.js → material-composition-types.js} +0 -0
  158. /package/{correction-types.js → search-index-plan-types.js} +0 -0
@@ -0,0 +1,403 @@
1
+ /**
2
+ * Hand-mirrored wire types for MATERIAL composition — what a product is made
3
+ * of (`GET /api/v1/materials/{variantId}/composition`, operation
4
+ * `get_material_composition`, and `GET /api/v1/composition/report`, operation
5
+ * `get_composition_report`; MG-1969).
6
+ *
7
+ * Composition means only this. It is unrelated to `./slot-pool-types.ts`,
8
+ * the candidate pools a scheme composer outside MaterialGraph reads.
9
+ *
10
+ * Like the rest of the SDK these interfaces carry NO runtime dependency on any
11
+ * `@materialgraph/*` package; they mirror the `VariantComposition` and
12
+ * `CompositionCorpusSummary` shapes in `apps/web/public/openapi.yaml`.
13
+ *
14
+ * TOLERANT-PARSING CONTRACT: response enums are widened with {@link OpenEnum}
15
+ * so a new server value still type-checks; objects are read structurally. The
16
+ * one exception is {@link VariantCompositionAbsence}, which is closed —
17
+ * see below.
18
+ */
19
+ import type { VariantId } from "./identifiers.js";
20
+ import type { OpenEnum } from "./types.js";
21
+ /**
22
+ * Why no parse stands behind a material. CLOSED on purpose: a consumer must
23
+ * branch on every arm, and widening it would let a new reason fall through a
24
+ * branch that reads "one of these two, so it must be the other".
25
+ *
26
+ * - `no_material_bank_sku` — the variant was never a Material Bank SKU, so
27
+ * there is no catalogue row anyone could have parsed.
28
+ * - `not_linked` — it has a SKU and the corpus has not reached it. A statement
29
+ * about MaterialGraph's coverage, never about the material.
30
+ *
31
+ * Neither is the same as a present parse whose `status` is `empty`: that is the
32
+ * catalogue row saying it declared nothing, which is knowledge.
33
+ */
34
+ export type VariantCompositionAbsence = "no_material_bank_sku" | "not_linked";
35
+ /** `failed_closed` means the parser refused rather than guessed. */
36
+ export type CompositionParseStatus = OpenEnum<"parsed" | "empty" | "failed_closed">;
37
+ /** One document or catalogue column the record's facts are taken from. */
38
+ export type CompositionSource = {
39
+ id: string;
40
+ kind: OpenEnum<"epd" | "hpd" | "technical_document" | "manufacturer" | "reseller" | "test_report" | "catalogue_field" | "inference" | "other">;
41
+ /** A URL, a document name, or the catalogue column name. */
42
+ locator: string;
43
+ retrievedAt?: string;
44
+ /** The source's wording, verbatim. Never corrected or completed. */
45
+ statement?: string;
46
+ title?: string;
47
+ };
48
+ /**
49
+ * A percentage as the source gives it, or one of the four ways a source can
50
+ * name a node and still withhold the number. `undisclosed` holds its place in
51
+ * the sum; `alternate` sits outside it.
52
+ */
53
+ export type CompositionAmount = {
54
+ kind: "exact";
55
+ value: number;
56
+ } | {
57
+ kind: "range";
58
+ max: number;
59
+ min: number;
60
+ } | {
61
+ kind: "bound";
62
+ operator: OpenEnum<"at_most" | "at_least" | "less_than" | "greater_than">;
63
+ value: number;
64
+ } | {
65
+ kind: "unknown";
66
+ } | {
67
+ kind: "undisclosed";
68
+ reason: OpenEnum<"trade_secret" | "not_provided">;
69
+ } | {
70
+ kind: "conditionally_present";
71
+ max: number;
72
+ } | {
73
+ kind: "band";
74
+ band: string;
75
+ version: string;
76
+ vocabulary: string;
77
+ } | {
78
+ kind: "alternate";
79
+ } | {
80
+ kind: string;
81
+ };
82
+ /** How much of its parent, or of the whole product, a node is. */
83
+ export type CompositionShare = {
84
+ amount: CompositionAmount;
85
+ /** What the percentage measures, only as the source says it. Never converted. */
86
+ basis: OpenEnum<"mass" | "volume" | "fibre_mass" | "area" | "count" | "thickness" | "unspecified">;
87
+ of: OpenEnum<"parent" | "product">;
88
+ source: string;
89
+ };
90
+ /** An absolute figure the source states, in its own unit. Never in the sum. */
91
+ export type CompositionQuantity = {
92
+ amount: {
93
+ kind: "exact";
94
+ value: number;
95
+ } | {
96
+ kind: "range";
97
+ max: number;
98
+ min: number;
99
+ } | {
100
+ kind: "bound";
101
+ operator: OpenEnum<"at_most" | "at_least" | "less_than" | "greater_than">;
102
+ value: number;
103
+ } | {
104
+ kind: string;
105
+ };
106
+ /** The figure and unit as the source writes them. */
107
+ raw: string;
108
+ unit: OpenEnum<"mm" | "in" | "mil" | "gauge" | "oz_yd2" | "g_m2" | "kg" | "kg_m3" | "pcf" | "dtex" | "denier" | "ply">;
109
+ };
110
+ /**
111
+ * Which substance a component is. `resolution` is the field to read before
112
+ * trusting `term`: `identified` is the only arm carrying a dictionary id that
113
+ * means what the source said.
114
+ */
115
+ export type CompositionTermRef = {
116
+ /** The source's own words, verbatim. */
117
+ raw: string;
118
+ resolution: OpenEnum<"identified" | "proprietary" | "withheld" | "unresolved">;
119
+ source?: string;
120
+ term?: string;
121
+ };
122
+ /** Dictionary ids qualifying a term without changing it. */
123
+ export type CompositionModifiers = {
124
+ brand?: string;
125
+ cut?: string;
126
+ grade?: string;
127
+ origin?: string;
128
+ process?: string[];
129
+ provenance?: string;
130
+ treatment?: string[];
131
+ };
132
+ /** A statement about a node that is not a share. Claims never enter the sum. */
133
+ export type CompositionClaim = {
134
+ amount?: CompositionAmount;
135
+ kind: OpenEnum<"free_of" | "contains" | "recyclable" | "renewable" | "bio_based" | "biodegradable" | "compostable" | "certified" | "other">;
136
+ /** The claim's wording, verbatim. */
137
+ raw: string;
138
+ source: string;
139
+ term?: string;
140
+ };
141
+ /** The level above which the source says every substance is listed. */
142
+ export type CompositionThreshold = {
143
+ raw: string;
144
+ regime: OpenEnum<"100_ppm" | "1000_ppm" | "ghs_sds" | "other">;
145
+ scope: OpenEnum<"product" | "material">;
146
+ source: string;
147
+ };
148
+ /**
149
+ * Whether the source presents a node's children as exhaustive. `partial` and
150
+ * `unspecified` are both statements about the SOURCE; neither licenses adding
151
+ * a child to make a list add up.
152
+ */
153
+ export type CompositionCoverage = {
154
+ claim: OpenEnum<"complete" | "partial" | "unspecified">;
155
+ source?: string;
156
+ threshold?: CompositionThreshold;
157
+ };
158
+ /** Why the unstated part of a composition is unstated. */
159
+ export type CompositionRemainder = {
160
+ kind: "legally_omitted";
161
+ regime: OpenEnum<"eu_1007_2011" | "us_16_cfr_303">;
162
+ rule: string;
163
+ source: string;
164
+ } | {
165
+ kind: "undisclosed";
166
+ reason: OpenEnum<"trade_secret" | "not_provided">;
167
+ source: string;
168
+ } | {
169
+ kind: string;
170
+ };
171
+ /** One named substance with its share. Never an unstated remainder. */
172
+ export type CompositionComponent = {
173
+ claims: CompositionClaim[];
174
+ /** "Of which" subsets of this component; their shares are of it. */
175
+ components?: CompositionComponent[];
176
+ id: string;
177
+ identity: CompositionTermRef;
178
+ modifiers: CompositionModifiers;
179
+ quantity?: CompositionQuantity;
180
+ /** What the substance does inside its part, only where the source says. */
181
+ role?: string;
182
+ share: CompositionShare;
183
+ source: string;
184
+ };
185
+ /** A layer or piece of the product. Sibling parts are co-present and sum. */
186
+ export type CompositionPart = {
187
+ claims: CompositionClaim[];
188
+ components: CompositionComponent[];
189
+ construction: string[];
190
+ coverage: CompositionCoverage;
191
+ id: string;
192
+ /** The part's name as the source writes it. */
193
+ label?: string;
194
+ /** Alternatives the buyer chooses between; options never sum with siblings. */
195
+ options?: CompositionPart[];
196
+ parts?: CompositionPart[];
197
+ /** Stacking order among siblings: 0 is the top or outer face. */
198
+ position: number;
199
+ quantity?: CompositionQuantity;
200
+ remainder?: CompositionRemainder;
201
+ role?: string;
202
+ share: CompositionShare;
203
+ source: string;
204
+ };
205
+ /** The composition of one product, as the cited sources state it. */
206
+ export type CompositionRecord = {
207
+ claims: CompositionClaim[];
208
+ /** The whole product's own inventory; never summed with `parts`. */
209
+ components: CompositionComponent[];
210
+ construction: string[];
211
+ coverage: CompositionCoverage;
212
+ id: string;
213
+ name: string;
214
+ /** Alternatives the buyer chooses between, each a full record. */
215
+ options?: CompositionRecord[];
216
+ parts: CompositionPart[];
217
+ primarySource?: string;
218
+ remainder?: CompositionRemainder;
219
+ sources: CompositionSource[];
220
+ };
221
+ /**
222
+ * The record flattened to the `composition_weighted` attribute value.
223
+ *
224
+ * `basis: "tokens_only"` says the PROPORTIONS are unknown, never that the
225
+ * components are, and every entry then carries a component with no `fraction`.
226
+ * An absent `fraction` is an unknown share; `0` is a declared none.
227
+ */
228
+ export type CompositionWeightedValue = {
229
+ basis: OpenEnum<"declared_percent" | "single_material" | "tokens_only">;
230
+ components: {
231
+ /** A `composition_component` dictionary term id. */
232
+ component: string;
233
+ /** 0 to 1, never a percentage. */
234
+ fraction?: number;
235
+ tolerance?: number;
236
+ }[];
237
+ [key: string]: unknown;
238
+ };
239
+ /** What meeting a need lets a reader do with the record. */
240
+ export type CompositionUnlock = OpenEnum<"specify" | "substitute" | "compare">;
241
+ /**
242
+ * Why a record was not measured against a bar. Null exactly when
243
+ * `completeness` is present. CLOSED, like {@link VariantCompositionAbsence}:
244
+ * a consumer must branch on every arm.
245
+ *
246
+ * - `no_record` — nothing was parsed, so there is nothing to measure.
247
+ * - `no_product_type` — a record exists, but the tuple resolved to no product
248
+ * type, so there is no bar to pick.
249
+ * - `no_bar_set` — both exist and MaterialGraph has authored no requirement
250
+ * for that product type. A gap in OUR registry. Rendering it as an unscored
251
+ * record reads as a fault in the maker's data.
252
+ */
253
+ export type CompositionCompletenessAbsence = "no_record" | "no_product_type" | "no_bar_set";
254
+ /**
255
+ * A record measured against its product type's authored bar, AT READ TIME.
256
+ * Absent (rather than zeroed) when it could not be measured; read
257
+ * `completenessAbsent` for which of the three reasons applies.
258
+ */
259
+ export type CompositionCompleteness = {
260
+ met: number;
261
+ needs: {
262
+ id: string;
263
+ label: string;
264
+ met: boolean;
265
+ unlocks: CompositionUnlock[];
266
+ }[];
267
+ productTypeId: string;
268
+ /** met / total, 0 to 1, to three decimal places. */
269
+ share: number;
270
+ total: number;
271
+ /** Open when every need tagged with it is met. */
272
+ unlocks: {
273
+ compare: boolean;
274
+ specify: boolean;
275
+ substitute: boolean;
276
+ };
277
+ };
278
+ /** The stored parse, with the contract it was written under. */
279
+ export type VariantCompositionParse = {
280
+ parseKey: string;
281
+ status: CompositionParseStatus;
282
+ /** Null when the parse stored none; `empty` and `failed_closed` always do. */
283
+ record: CompositionRecord | null;
284
+ projection: CompositionWeightedValue | null;
285
+ /** Unresolved wording, or the error text when the parse failed closed. */
286
+ unresolved: {
287
+ raw: string;
288
+ source: string;
289
+ }[];
290
+ modelId: string;
291
+ schemaVersion: string;
292
+ dictionaryVersion: string;
293
+ parsedAt: string;
294
+ };
295
+ /**
296
+ * What a material is made of, traced to the catalogue columns it came from.
297
+ *
298
+ * READ `absent` FIRST. When it is set there is no parse, and its value says
299
+ * why. When it is null there is a parse, and `parse.status` may still be
300
+ * `empty` — the catalogue row was read and declared nothing.
301
+ *
302
+ * `productType` is inferred for the TUPLE, which many products share, so it is
303
+ * never a statement about this variant's own category.
304
+ */
305
+ export type VariantComposition = {
306
+ variantId: VariantId;
307
+ materialBankSku: string | null;
308
+ /** The verbatim catalogue cells, keyed by column name. */
309
+ catalogue: {
310
+ tuple: Record<string, string>;
311
+ } | null;
312
+ parse: VariantCompositionParse | null;
313
+ productType: {
314
+ id: string;
315
+ share: number | null;
316
+ } | null;
317
+ completeness: CompositionCompleteness | null;
318
+ /** Null exactly when `completeness` is present. */
319
+ completenessAbsent: CompositionCompletenessAbsence | null;
320
+ absent: VariantCompositionAbsence | null;
321
+ };
322
+ /** A count in both currencies. The Live SKU figure is the answer. */
323
+ export type CompositionCorpusWeight = {
324
+ tuples: number;
325
+ liveSkus: number;
326
+ };
327
+ export type CompositionCorpusShare = CompositionCorpusWeight & {
328
+ liveSkuShare: number | null;
329
+ tupleShare: number | null;
330
+ };
331
+ export type CompositionCorpusNeedCoverage = {
332
+ id: string;
333
+ label: string;
334
+ unlocks: CompositionUnlock[];
335
+ /** Share of the type's measured Live SKUs whose record meets this need. */
336
+ liveSkuShare: number | null;
337
+ tupleShare: number | null;
338
+ };
339
+ export type CompositionCorpusTypeCoverage = {
340
+ productTypeId: string;
341
+ measured: CompositionCorpusWeight;
342
+ failedClosed: CompositionCorpusWeight;
343
+ empty: CompositionCorpusWeight;
344
+ needs: CompositionCorpusNeedCoverage[];
345
+ /**
346
+ * Share of the type's measured rows meeting EVERY need — the whole bar.
347
+ * Not the same as an unlock being open, which only requires the needs
348
+ * tagged with that unlock. Draw a completeness bar from this.
349
+ */
350
+ complete: {
351
+ liveSkuShare: number | null;
352
+ tupleShare: number | null;
353
+ };
354
+ unlocks: {
355
+ compare: number | null;
356
+ specify: number | null;
357
+ substitute: number | null;
358
+ };
359
+ /** The need the most Live SKUs are missing, or null when every need is met. */
360
+ mostMissedNeed: {
361
+ id: string;
362
+ label: string;
363
+ liveSkus: number;
364
+ } | null;
365
+ };
366
+ /**
367
+ * How far the material composition corpus has got.
368
+ *
369
+ * `authoringQueue` lists product types SKUs were assigned to but no
370
+ * requirement has been written for. They have NO BAR SET, which is why they
371
+ * are listed apart rather than scored zero.
372
+ */
373
+ export type CompositionCorpusSummary = {
374
+ completeness: {
375
+ authoringQueue: (CompositionCorpusWeight & {
376
+ productTypeId: string;
377
+ })[];
378
+ byProductType: CompositionCorpusTypeCoverage[];
379
+ unknownProductType: CompositionCorpusWeight;
380
+ };
381
+ coverage: {
382
+ failedClosed: CompositionCorpusWeight;
383
+ /** Tuples with no text to parse at all; not a parser failure. */
384
+ noValue: CompositionCorpusWeight;
385
+ resolvable: CompositionCorpusShare;
386
+ validity: CompositionCorpusShare;
387
+ withValue: CompositionCorpusWeight;
388
+ };
389
+ dictionaryVersion: string;
390
+ /** The corpus's own list-price spend, never a per-request figure. */
391
+ tokens: {
392
+ costUsd: {
393
+ input: number;
394
+ output: number;
395
+ total: number;
396
+ };
397
+ inputTokens: number;
398
+ outputTokens: number;
399
+ };
400
+ parses: number;
401
+ linkedSkus: number;
402
+ generatedAt: string;
403
+ };
@@ -1,154 +1,70 @@
1
1
  /** Hand-mirrored wire types for `POST /api/v1/search/plan`. */
2
- import type { QuerySense } from "./query-understanding-types.js";
3
- import type { ResolvedMeaning } from "./resolve-types.js";
4
- import type { SearchInput } from "./search-request-types.js";
5
2
  import type { OpenEnum } from "./types.js";
6
- export type MaterialQueryVocabularyKind = OpenEnum<"attribute" | "dictionary_term" | "inline_enum" | "product_type" | "product_type_group">;
7
- export interface MaterialQuerySpan {
8
- start: number;
9
- end: number;
10
- text: string;
11
- }
12
- export interface MaterialQueryOwner {
13
- attributeId: string;
14
- attributeName: string;
15
- }
16
- export interface MaterialQueryLifecycle {
17
- status: string;
18
- introducedIn?: string;
19
- deprecatedIn?: string;
20
- supersededBy?: string;
21
- }
22
- export type MaterialQueryOntologyContext = {
23
- description: string;
24
- valueKind: string;
25
- valueDictionaryId?: string;
26
- } | {
27
- dictionaryId: string;
28
- dictionaryName: string;
29
- owningAttributes: Array<{
30
- id: string;
31
- name: string;
32
- }>;
33
- lifecycle: MaterialQueryLifecycle;
34
- } | {
3
+ /** One wanted value: hard filters the page, soft only orders it. */
4
+ export type MaterialQueryWant = {
35
5
  attributeId: string;
36
- attributeName: string;
37
- } | {
38
- description: string;
39
- lifecycle: MaterialQueryLifecycle;
40
- parentProductTypeGroupId?: string;
41
- } | {
42
- description: string;
6
+ terms: string[];
7
+ phrase: string;
8
+ strength: OpenEnum<"hard" | "soft">;
9
+ fill: number;
43
10
  };
44
- export interface MaterialQueryApplicability {
45
- status: OpenEnum<"all" | "some" | "none" | "unknown">;
46
- categoryId?: string;
47
- productTypeIds: string[];
48
- applicableProductTypeIds: string[];
49
- }
50
- export interface MaterialQueryCoverage {
51
- variants: number;
52
- basis: OpenEnum<"facet_index">;
53
- scope: OpenEnum<"corpus">;
54
- }
55
- export interface MaterialQueryReachability {
56
- status: OpenEnum<"positive" | "zero" | "unknown">;
57
- categoryId: string;
58
- basis: OpenEnum<"bounded_probe" | "unmeasured">;
59
- }
60
- export interface MaterialQueryCandidate {
61
- kind: MaterialQueryVocabularyKind;
62
- subjectType: MaterialQueryVocabularyKind;
63
- subjectId: string;
64
- label: string;
65
- context: MaterialQueryOntologyContext;
66
- score: number;
67
- tier: OpenEnum<"exact_id" | "exact_alias" | "lexical" | "semantic">;
68
- evidence: {
69
- source: OpenEnum<"registry" | "query_domain_embedding">;
70
- span: MaterialQuerySpan;
71
- };
72
- outcome: OpenEnum<"recognized" | "suggested" | "executable" | "ambiguous" | "refused">;
73
- owners: MaterialQueryOwner[];
74
- selectedOwner?: MaterialQueryOwner;
75
- applicability?: MaterialQueryApplicability;
76
- coverage?: MaterialQueryCoverage;
77
- reachability?: MaterialQueryReachability;
78
- reason?: string;
79
- }
80
- export interface MaterialQueryCriterion {
81
- source: {
82
- subjectType: MaterialQueryVocabularyKind;
83
- subjectId: string;
84
- span: MaterialQuerySpan;
85
- };
86
- attribute: {
87
- id: string;
88
- name: string;
89
- };
90
- ownerAlternatives: MaterialQueryOwner[];
91
- operator: OpenEnum<"term" | "presence" | "numeric_range">;
92
- term?: string;
93
- min?: number;
94
- max?: number;
95
- coverage: MaterialQueryCoverage;
96
- applicability: MaterialQueryApplicability;
97
- reachability?: MaterialQueryReachability;
98
- }
99
- export type MaterialQueryStandardMeaning = ResolvedMeaning | QuerySense;
100
- export type MaterialQueryAmbiguityAlternative = (MaterialQueryOwner & {
101
- kind: OpenEnum<"owner">;
102
- }) | {
103
- kind: OpenEnum<"subject">;
104
- subjectType: MaterialQueryVocabularyKind;
105
- subjectId: string;
106
- label: string;
107
- } | {
108
- kind: OpenEnum<"standard_meaning">;
109
- meaning: MaterialQueryStandardMeaning;
11
+ export type MaterialQueryExclusion = {
12
+ attributeId: string;
13
+ term: string;
14
+ phrase: string;
110
15
  };
111
- export interface MaterialQueryPlan {
112
- version: OpenEnum<"1">;
113
- verdict: OpenEnum<"executable" | "partial" | "refused">;
114
- rawQuery: string;
115
- normalisedQuery: string;
116
- registry: {
117
- corpusSize: number;
118
- contentHash: string;
119
- };
120
- candidates: MaterialQueryCandidate[];
16
+ /** The dictionary reading of one query, as the index search runs it. */
17
+ export type MaterialQueryReading = {
18
+ normalised: string;
121
19
  category: {
122
- key: string;
123
- name: string;
124
- level: OpenEnum<"group" | "type">;
125
- parentKey: string | null;
126
- source: {
127
- subjectType: MaterialQueryVocabularyKind;
128
- subjectId: string;
129
- span: MaterialQuerySpan;
130
- };
20
+ productTypeIds: string[];
21
+ label: string;
22
+ phrase: string;
23
+ } | null;
24
+ brands: {
25
+ ids: string[];
26
+ names: string[];
27
+ phrase: string;
131
28
  } | null;
132
- criteria: MaterialQueryCriterion[];
29
+ wants: MaterialQueryWant[];
30
+ excludes: MaterialQueryExclusion[];
31
+ excludeBrands: string[];
133
32
  colour: {
134
- family?: string;
135
- undertone?: string;
33
+ phrase: string;
34
+ familyId: string;
35
+ hex: string;
36
+ oklab: [number, number, number];
37
+ family12: string[];
136
38
  } | null;
137
- residualText: string;
138
- unspentSpans: Array<MaterialQuerySpan & {
139
- reason: OpenEnum<"residual" | "ambiguous" | "refused">;
140
- }>;
141
- ambiguities: Array<{
142
- subjectType: MaterialQueryVocabularyKind;
143
- subjectId: string;
144
- span: MaterialQuerySpan;
145
- reason: string;
146
- alternatives: MaterialQueryAmbiguityAlternative[];
147
- }>;
148
- standardMeanings: Array<{
149
- span: MaterialQuerySpan;
150
- meanings: MaterialQueryStandardMeaning[];
151
- }>;
152
- /** Complete ordinary-search requests authored by MaterialGraph. Execute verbatim. */
153
- requests: SearchInput[];
154
- }
39
+ vendorColourNames: string[];
40
+ leftover: string[];
41
+ softAlone: boolean;
42
+ };
43
+ /** Present when a word no material carries was corrected: showing results for `to`. */
44
+ export type MaterialQueryCorrection = {
45
+ from: string;
46
+ to: string;
47
+ words: {
48
+ word: string;
49
+ correction: string;
50
+ }[];
51
+ };
52
+ /** One search over the index. */
53
+ export type MaterialSearchRequest = {
54
+ text: string;
55
+ view?: OpenEnum<"card" | "full">;
56
+ limit?: number;
57
+ cursor?: string;
58
+ };
59
+ export type MaterialQueryPlan = {
60
+ version: OpenEnum<"2">;
61
+ rawQuery: string;
62
+ normalisedQuery: string;
63
+ readingVersion: string;
64
+ source: OpenEnum<"dictionary" | "jev">;
65
+ cached: boolean;
66
+ plan: MaterialQueryReading;
67
+ correction: MaterialQueryCorrection | null;
68
+ /** The one search to run, in the phrasing that was read. */
69
+ requests: MaterialSearchRequest[];
70
+ };
@@ -1,18 +1,20 @@
1
- /** Material blocks, safe assets, and technical documents over one shared transport. */
2
- import { HttpTransport } from "./http-transport.js";
1
+ /** Material blocks, a variant's assets, and technical documents over one shared transport. */
2
+ import type { HttpTransport } from "./http-transport.js";
3
3
  import type { VariantId } from "./identifiers.js";
4
- import type { MaterialAssetProjection, MaterialDocumentPage, MaterialDocumentPageOptions } from "./material-asset-types.js";
4
+ import type { ListVariantAssetsOptions, MaterialDocumentPage, MaterialDocumentPageOptions, VariantAssetPage } from "./material-asset-types.js";
5
5
  import type { MaterialBlockProjection } from "./material-block-types.js";
6
- import type { MaterialRenderAssets } from "./render-assets-types.js";
7
6
  /** Read known and explicitly unobserved canonical material fields. */
8
- export declare function materialBlocks(transport: HttpTransport, variantId: VariantId, signal?: AbortSignal): Promise<MaterialBlockProjection>;
9
- /** Read only redistribution-safe images and downloads for a material. */
10
- export declare function materialAssets(transport: HttpTransport, variantId: VariantId, signal?: AbortSignal): Promise<MaterialAssetProjection>;
11
- /** Read the accepted render-ready appearance projection, or an explicit unavailable reason. */
12
- export declare function materialRenderAssets(transport: HttpTransport, variantId: VariantId, signal?: AbortSignal): Promise<MaterialRenderAssets>;
7
+ export declare const materialBlocks: (transport: HttpTransport, variantId: VariantId, signal?: AbortSignal) => Promise<MaterialBlockProjection>;
8
+ /**
9
+ * Read one bounded, filtered, cursor-paged page of a variant's images and
10
+ * files. `imageRoles` narrows only images and `documentTypes` narrows only
11
+ * documents, each implying its own kind; the server refuses either paired
12
+ * with other kinds, or with each other, rather than silently widening.
13
+ */
14
+ export declare const listVariantAssets: (transport: HttpTransport, variantId: VariantId, options?: ListVariantAssetsOptions, signal?: AbortSignal) => Promise<VariantAssetPage>;
13
15
  /**
14
16
  * Read the owning Product's URL-deduplicated document page. Variant declarations
15
17
  * retain exact attribution; consumers inspect `appliesToRequestedVariant`
16
18
  * before presenting a sibling Variant declaration as applicable.
17
19
  */
18
- export declare function materialDocuments(transport: HttpTransport, variantId: VariantId, options?: MaterialDocumentPageOptions, signal?: AbortSignal): Promise<MaterialDocumentPage>;
20
+ export declare const materialDocuments: (transport: HttpTransport, variantId: VariantId, options?: MaterialDocumentPageOptions, signal?: AbortSignal) => Promise<MaterialDocumentPage>;