@instruments/materialgraph 0.31.0 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/by-spec-types.d.ts +1 -2
- package/client.d.ts +21 -46
- package/client.js +25 -48
- package/index.d.ts +1 -3
- package/index.js +0 -1
- package/list-variants-types.d.ts +48 -9
- package/ndjson.d.ts +1 -1
- package/ndjson.js +1 -1
- package/operations.d.ts +1 -1
- package/operations.js +1 -1
- package/package.json +1 -1
- package/response-schemas.generated.d.ts +1 -1
- package/response-schemas.generated.js +28 -34
- package/search-result-validation.d.ts +0 -2
- package/search-result-validation.js +1 -17
- package/search-variants-types.d.ts +73 -0
- package/types.d.ts +2 -63
- package/validation.d.ts +0 -14
- package/validation.js +0 -38
- package/webmcp.generated.js +5 -6
- package/match-stream-types.d.ts +0 -306
- package/match-stream-types.js +0 -65
- package/match-stream.d.ts +0 -22
- package/match-stream.js +0 -308
- package/match-types.d.ts +0 -138
- /package/{match-types.js → search-variants-types.js} +0 -0
package/by-spec-types.d.ts
CHANGED
|
@@ -56,9 +56,8 @@ export type BySpecVerdictCell = {
|
|
|
56
56
|
* Why an `unverified` cell missed the bar; null otherwise.
|
|
57
57
|
* - `below_confidence` — the value is real but scored under the floor.
|
|
58
58
|
* - `basis_unmet` — the value's source is weaker than the criterion demanded.
|
|
59
|
-
* - `proposed` — the value is awaiting acceptance and is not yet on record.
|
|
60
59
|
*/
|
|
61
|
-
trustGap: "below_confidence" | "basis_unmet" |
|
|
60
|
+
trustGap: "below_confidence" | "basis_unmet" | null;
|
|
62
61
|
citation?: VerdictCitation;
|
|
63
62
|
};
|
|
64
63
|
/**
|
package/client.d.ts
CHANGED
|
@@ -15,13 +15,12 @@ import type { VariantId } from "./identifiers.js";
|
|
|
15
15
|
import type { ListEnumValuesOptions, ListEnumValuesResult } from "./list-enum-values-types.js";
|
|
16
16
|
import type { ListVariantFacetsInput, ListVariantFacetsOutput } from "./list-variant-facets-types.js";
|
|
17
17
|
import type { ListVariantsInput, ListVariantsOutput } from "./list-variants-types.js";
|
|
18
|
-
import type { MatchStreamEvent } from "./match-stream-types.js";
|
|
19
|
-
import type { MatchAnswer, MatchInput } from "./match-types.js";
|
|
20
18
|
import type { ListVariantAssetsOptions, MaterialDocumentPageOptions, VariantAssetPage } from "./material-asset-types.js";
|
|
21
19
|
import type { MaterialQueryPlan } from "./material-query-plan-types.js";
|
|
22
20
|
import type { SourceMaterialBatchReceipt, UploadSourceMaterialInput } from "./run-types.js";
|
|
23
21
|
import type { SchemaResource, SchemaResourceResponse } from "./schema-resource-types.js";
|
|
24
22
|
import type { CardProjectionRequest, SearchCardResponse } from "./search-card-types.js";
|
|
23
|
+
import type { SearchVariantsInput, SearchVariantsOutput } from "./search-variants-types.js";
|
|
25
24
|
import type { ExtractPaletteInput, ExtractPaletteResponse, ListAttributesOptions, ListAttributesResult, PairingsOptions, PairingsResponse, ResolveColourOptions, ResolveColourResponse, SearchGetParams, SearchInput, SearchResponse, WhoamiResponse } from "./types.js";
|
|
26
25
|
import { WorkflowsClient } from "./workflows-client.js";
|
|
27
26
|
export * from "./client-config.js";
|
|
@@ -35,7 +34,6 @@ export * from "./client-config.js";
|
|
|
35
34
|
* | --- | --- |
|
|
36
35
|
* | "find me something like this / matching these words" | {@link MaterialGraphClient.search} |
|
|
37
36
|
* | "tell me about THIS variant" | {@link MaterialGraphClient.getVariant} |
|
|
38
|
-
* | "what's IN this photo?" | {@link MaterialGraphClient.match} / {@link MaterialGraphClient.matchStream} |
|
|
39
37
|
* | "which materials, from anyone, meet this hard spec?" | {@link MaterialGraphClient.listVariants} |
|
|
40
38
|
* | "what's near this colour / this palette?" | {@link MaterialGraphClient.byColour}, `colours.palette()` |
|
|
41
39
|
* | "what goes with THIS material?" | {@link MaterialGraphClient.pairings}, {@link MaterialGraphClient.listVariants} (same product, other colourways) |
|
|
@@ -107,7 +105,7 @@ export declare class MaterialGraphClient extends CatalogueClient {
|
|
|
107
105
|
* (ranking would be noise), {@link MaterialGraphClient.byColour} /
|
|
108
106
|
* `colours.palette()` for visual colour intent (`text` matches WORDS — "sage
|
|
109
107
|
* green" finds materials that SAY sage, not ones that look it),
|
|
110
|
-
* {@link MaterialGraphClient.
|
|
108
|
+
* {@link MaterialGraphClient.pairings}
|
|
111
109
|
* for what goes WITH something, {@link MaterialGraphClient.suggest} for typeahead.
|
|
112
110
|
*
|
|
113
111
|
* The full POST search primitive. `input.filters` are hard token sets on
|
|
@@ -130,44 +128,6 @@ export declare class MaterialGraphClient extends CatalogueClient {
|
|
|
130
128
|
view: "card";
|
|
131
129
|
}, signal?: AbortSignal): Promise<SearchCardResponse>;
|
|
132
130
|
searchGet(params: SearchGetParams, signal?: AbortSignal): Promise<SearchResponse>;
|
|
133
|
-
/**
|
|
134
|
-
* THE QUESTION: "what materials are in this PHOTO?" — Material Match classifies
|
|
135
|
-
* the image, decomposes it into surfaces, and answers each one.
|
|
136
|
-
*
|
|
137
|
-
* Instead use {@link MaterialGraphClient.matchStream} whenever a human is
|
|
138
|
-
* watching, {@link MaterialGraphClient.search} with `image` for ONE ranked list
|
|
139
|
-
* rather than a per-surface decomposition, and
|
|
140
|
-
* {@link MaterialGraphClient.extractPalette} for the image's colours only.
|
|
141
|
-
*
|
|
142
|
-
* Exactly one of `imageBase64`, `imageUrl` or `vector`. Read `qualityFloor` and
|
|
143
|
-
* `droppedBelowFloor` before reporting an empty result: "nothing was good
|
|
144
|
-
* enough" and "nothing was found" are different answers.
|
|
145
|
-
*/
|
|
146
|
-
match(input: MatchInput, signal?: AbortSignal): Promise<MatchAnswer>;
|
|
147
|
-
/**
|
|
148
|
-
* Material Match as a PROGRESSIVE stream — the same POST
|
|
149
|
-
* `/api/v1/search/match` endpoint negotiated with `Accept:
|
|
150
|
-
* application/x-ndjson`, which runs the scene workflow (classify → decompose →
|
|
151
|
-
* one match per surface) and emits an event as each surface resolves. Use this
|
|
152
|
-
* wherever the user watches a photo come apart; use {@link match} when you only
|
|
153
|
-
* want the finished answer.
|
|
154
|
-
*
|
|
155
|
-
* Iterate it directly — the request opens on the first `next()`:
|
|
156
|
-
*
|
|
157
|
-
* ```ts
|
|
158
|
-
* for await (const event of client.matchStream({ imageBase64 })) {
|
|
159
|
-
* if (event.type === "surface") render(event.surface);
|
|
160
|
-
* }
|
|
161
|
-
* ```
|
|
162
|
-
*
|
|
163
|
-
* Every frame is validated before it is yielded, and the iterator ends only on
|
|
164
|
-
* a `complete` or `error` event — a truncated connection raises rather than
|
|
165
|
-
* passing for a short run. `signal` cancels the in-flight request itself, as
|
|
166
|
-
* does breaking out of the loop; a cancelled stream ends without raising.
|
|
167
|
-
* Requires an image (`imageBase64` or `imageUrl`); a `vector` input is
|
|
168
|
-
* buffered-only.
|
|
169
|
-
*/
|
|
170
|
-
matchStream(input: MatchInput, signal?: AbortSignal): AsyncGenerator<MatchStreamEvent, void, unknown>;
|
|
171
131
|
/**
|
|
172
132
|
* THE QUESTION: "what materials are near THIS colour?" — one colour (or a small
|
|
173
133
|
* palette), ranked by OKLab closeness to colour extracted from product imagery.
|
|
@@ -242,9 +202,9 @@ export declare class MaterialGraphClient extends CatalogueClient {
|
|
|
242
202
|
* it names a real variant outside the materials catalogue, never silently
|
|
243
203
|
* dropped from the page.
|
|
244
204
|
*
|
|
245
|
-
* `filters`/`optionalFilters`/`orderBy` are sent as URL-encoded
|
|
246
|
-
* `attributes`/`include` as comma-separated lists — the server
|
|
247
|
-
* this method does not duplicate that check.
|
|
205
|
+
* `filters`/`optionalFilters`/`orderBy`/`colours` are sent as URL-encoded
|
|
206
|
+
* JSON; `attributes`/`include`/`words` as comma-separated lists — the server
|
|
207
|
+
* validates, this method does not duplicate that check.
|
|
248
208
|
*/
|
|
249
209
|
listVariants(input: ListVariantsInput, signal?: AbortSignal): Promise<ListVariantsOutput>;
|
|
250
210
|
/**
|
|
@@ -255,6 +215,21 @@ export declare class MaterialGraphClient extends CatalogueClient {
|
|
|
255
215
|
* `listVariants()` takes; the server validates both.
|
|
256
216
|
*/
|
|
257
217
|
listVariantFacets(input: ListVariantFacetsInput, signal?: AbortSignal): Promise<ListVariantFacetsOutput>;
|
|
218
|
+
/**
|
|
219
|
+
* THE QUESTION: "which variants match these plain words, and how did you
|
|
220
|
+
* read them?" (POST `/api/v1/variants/search`, MG-2223) — `query` is read
|
|
221
|
+
* into the filters {@link MaterialGraphClient.listVariants} takes, run
|
|
222
|
+
* through it, and answered with `understood` (what each phrase became, or
|
|
223
|
+
* why it did nothing) beside the page. `filters`, `optionalFilters` and
|
|
224
|
+
* `name` are exactly what ran, so the three can be sent to `listVariants()`
|
|
225
|
+
* to narrow or widen the same search; page with this method's own cursor,
|
|
226
|
+
* which `listVariants()` refuses. A phrase with several meanings is
|
|
227
|
+
* answered with one and listed in `choices`; send its `handle` with an
|
|
228
|
+
* alternative's `group` and `id` in `selections` to switch it. A query that
|
|
229
|
+
* applies nothing returns no items, never the whole catalogue; a preference
|
|
230
|
+
* alone still ranks it.
|
|
231
|
+
*/
|
|
232
|
+
searchVariants(input: SearchVariantsInput, signal?: AbortSignal): Promise<SearchVariantsOutput>;
|
|
258
233
|
/**
|
|
259
234
|
* THE QUESTION: "which variants hold, resemble, or can be ranked by, this
|
|
260
235
|
* colour?" (POST `/api/v1/variants/by-colour`, MG-2217/MG-2230/MG-2247).
|
|
@@ -321,7 +296,7 @@ export declare class MaterialGraphClient extends CatalogueClient {
|
|
|
321
296
|
* materials. The bridge from an inspiration image into the colour lens: extract
|
|
322
297
|
* here, then feed the swatches to `colours.palette()` or
|
|
323
298
|
* {@link MaterialGraphClient.byColour}. Instead use
|
|
324
|
-
|
|
299
|
+
|
|
325
300
|
*/
|
|
326
301
|
extractPalette(input: ExtractPaletteInput, signal?: AbortSignal): Promise<ExtractPaletteResponse>;
|
|
327
302
|
/** "Whose catalogs are in here, and how big is each?" — {@link listBrands}. */
|
package/client.js
CHANGED
|
@@ -7,7 +7,6 @@ import { listAttributes as listAttributesCall, listEnumValues as listEnumValuesC
|
|
|
7
7
|
import { ColoursClient } from "./colours-client.js";
|
|
8
8
|
import { MaterialGraphError } from "./errors.js";
|
|
9
9
|
import { HttpTransport } from "./http-transport.js";
|
|
10
|
-
import { matchStream as matchStreamCall } from "./match-stream.js";
|
|
11
10
|
import { listVariantAssets as listVariantAssetsCall, materialBlocks as materialBlocksCall, materialDocuments as materialDocumentsCall, } from "./material-resources-client.js";
|
|
12
11
|
// Aliased to `operation` — the local name every call site here already used.
|
|
13
12
|
import { resolveOperation as operation } from "./operations.js";
|
|
@@ -26,7 +25,6 @@ export * from "./client-config.js";
|
|
|
26
25
|
* | --- | --- |
|
|
27
26
|
* | "find me something like this / matching these words" | {@link MaterialGraphClient.search} |
|
|
28
27
|
* | "tell me about THIS variant" | {@link MaterialGraphClient.getVariant} |
|
|
29
|
-
* | "what's IN this photo?" | {@link MaterialGraphClient.match} / {@link MaterialGraphClient.matchStream} |
|
|
30
28
|
* | "which materials, from anyone, meet this hard spec?" | {@link MaterialGraphClient.listVariants} |
|
|
31
29
|
* | "what's near this colour / this palette?" | {@link MaterialGraphClient.byColour}, `colours.palette()` |
|
|
32
30
|
* | "what goes with THIS material?" | {@link MaterialGraphClient.pairings}, {@link MaterialGraphClient.listVariants} (same product, other colourways) |
|
|
@@ -135,48 +133,6 @@ export class MaterialGraphClient extends CatalogueClient {
|
|
|
135
133
|
async searchGet(params, signal) {
|
|
136
134
|
return await this.#get("search_materials_get", { ...params }, signal);
|
|
137
135
|
}
|
|
138
|
-
/**
|
|
139
|
-
* THE QUESTION: "what materials are in this PHOTO?" — Material Match classifies
|
|
140
|
-
* the image, decomposes it into surfaces, and answers each one.
|
|
141
|
-
*
|
|
142
|
-
* Instead use {@link MaterialGraphClient.matchStream} whenever a human is
|
|
143
|
-
* watching, {@link MaterialGraphClient.search} with `image` for ONE ranked list
|
|
144
|
-
* rather than a per-surface decomposition, and
|
|
145
|
-
* {@link MaterialGraphClient.extractPalette} for the image's colours only.
|
|
146
|
-
*
|
|
147
|
-
* Exactly one of `imageBase64`, `imageUrl` or `vector`. Read `qualityFloor` and
|
|
148
|
-
* `droppedBelowFloor` before reporting an empty result: "nothing was good
|
|
149
|
-
* enough" and "nothing was found" are different answers.
|
|
150
|
-
*/
|
|
151
|
-
async match(input, signal) {
|
|
152
|
-
return await this.#post("match_material", input, signal);
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Material Match as a PROGRESSIVE stream — the same POST
|
|
156
|
-
* `/api/v1/search/match` endpoint negotiated with `Accept:
|
|
157
|
-
* application/x-ndjson`, which runs the scene workflow (classify → decompose →
|
|
158
|
-
* one match per surface) and emits an event as each surface resolves. Use this
|
|
159
|
-
* wherever the user watches a photo come apart; use {@link match} when you only
|
|
160
|
-
* want the finished answer.
|
|
161
|
-
*
|
|
162
|
-
* Iterate it directly — the request opens on the first `next()`:
|
|
163
|
-
*
|
|
164
|
-
* ```ts
|
|
165
|
-
* for await (const event of client.matchStream({ imageBase64 })) {
|
|
166
|
-
* if (event.type === "surface") render(event.surface);
|
|
167
|
-
* }
|
|
168
|
-
* ```
|
|
169
|
-
*
|
|
170
|
-
* Every frame is validated before it is yielded, and the iterator ends only on
|
|
171
|
-
* a `complete` or `error` event — a truncated connection raises rather than
|
|
172
|
-
* passing for a short run. `signal` cancels the in-flight request itself, as
|
|
173
|
-
* does breaking out of the loop; a cancelled stream ends without raising.
|
|
174
|
-
* Requires an image (`imageBase64` or `imageUrl`); a `vector` input is
|
|
175
|
-
* buffered-only.
|
|
176
|
-
*/
|
|
177
|
-
matchStream(input, signal) {
|
|
178
|
-
return matchStreamCall(this.#transport, input, signal);
|
|
179
|
-
}
|
|
180
136
|
/**
|
|
181
137
|
* THE QUESTION: "what materials are near THIS colour?" — one colour (or a small
|
|
182
138
|
* palette), ranked by OKLab closeness to colour extracted from product imagery.
|
|
@@ -294,9 +250,9 @@ export class MaterialGraphClient extends CatalogueClient {
|
|
|
294
250
|
* it names a real variant outside the materials catalogue, never silently
|
|
295
251
|
* dropped from the page.
|
|
296
252
|
*
|
|
297
|
-
* `filters`/`optionalFilters`/`orderBy` are sent as URL-encoded
|
|
298
|
-
* `attributes`/`include` as comma-separated lists — the server
|
|
299
|
-
* this method does not duplicate that check.
|
|
253
|
+
* `filters`/`optionalFilters`/`orderBy`/`colours` are sent as URL-encoded
|
|
254
|
+
* JSON; `attributes`/`include`/`words` as comma-separated lists — the server
|
|
255
|
+
* validates, this method does not duplicate that check.
|
|
300
256
|
*/
|
|
301
257
|
async listVariants(input, signal) {
|
|
302
258
|
return await this.#get("list_variants", {
|
|
@@ -304,6 +260,9 @@ export class MaterialGraphClient extends CatalogueClient {
|
|
|
304
260
|
? input.attributes.join(",")
|
|
305
261
|
: undefined,
|
|
306
262
|
collapse: input.collapse,
|
|
263
|
+
colours: input.colours?.length
|
|
264
|
+
? JSON.stringify(input.colours)
|
|
265
|
+
: undefined,
|
|
307
266
|
corpusScope: input.corpusScope,
|
|
308
267
|
cursor: input.cursor,
|
|
309
268
|
filters: input.filters ? JSON.stringify(input.filters) : undefined,
|
|
@@ -316,6 +275,7 @@ export class MaterialGraphClient extends CatalogueClient {
|
|
|
316
275
|
orderBy: input.orderBy?.length
|
|
317
276
|
? JSON.stringify(input.orderBy)
|
|
318
277
|
: undefined,
|
|
278
|
+
words: input.words?.length ? input.words.join(",") : undefined,
|
|
319
279
|
}, signal);
|
|
320
280
|
}
|
|
321
281
|
/**
|
|
@@ -328,6 +288,23 @@ export class MaterialGraphClient extends CatalogueClient {
|
|
|
328
288
|
async listVariantFacets(input, signal) {
|
|
329
289
|
return await this.#post("list_variant_facets", input, signal);
|
|
330
290
|
}
|
|
291
|
+
/**
|
|
292
|
+
* THE QUESTION: "which variants match these plain words, and how did you
|
|
293
|
+
* read them?" (POST `/api/v1/variants/search`, MG-2223) — `query` is read
|
|
294
|
+
* into the filters {@link MaterialGraphClient.listVariants} takes, run
|
|
295
|
+
* through it, and answered with `understood` (what each phrase became, or
|
|
296
|
+
* why it did nothing) beside the page. `filters`, `optionalFilters` and
|
|
297
|
+
* `name` are exactly what ran, so the three can be sent to `listVariants()`
|
|
298
|
+
* to narrow or widen the same search; page with this method's own cursor,
|
|
299
|
+
* which `listVariants()` refuses. A phrase with several meanings is
|
|
300
|
+
* answered with one and listed in `choices`; send its `handle` with an
|
|
301
|
+
* alternative's `group` and `id` in `selections` to switch it. A query that
|
|
302
|
+
* applies nothing returns no items, never the whole catalogue; a preference
|
|
303
|
+
* alone still ranks it.
|
|
304
|
+
*/
|
|
305
|
+
async searchVariants(input, signal) {
|
|
306
|
+
return await this.#post("search_variants", input, signal);
|
|
307
|
+
}
|
|
331
308
|
/**
|
|
332
309
|
* THE QUESTION: "which variants hold, resemble, or can be ranked by, this
|
|
333
310
|
* colour?" (POST `/api/v1/variants/by-colour`, MG-2217/MG-2230/MG-2247).
|
|
@@ -419,7 +396,7 @@ export class MaterialGraphClient extends CatalogueClient {
|
|
|
419
396
|
* materials. The bridge from an inspiration image into the colour lens: extract
|
|
420
397
|
* here, then feed the swatches to `colours.palette()` or
|
|
421
398
|
* {@link MaterialGraphClient.byColour}. Instead use
|
|
422
|
-
|
|
399
|
+
|
|
423
400
|
*/
|
|
424
401
|
async extractPalette(input, signal) {
|
|
425
402
|
return await this.#post("extract_image_palette", input, signal);
|
package/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ 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";
|
|
@@ -28,9 +29,6 @@ export { ColoursClient } from "./colours-client.js";
|
|
|
28
29
|
export type { ColoursTransport } from "./colours-client.js";
|
|
29
30
|
export type * from "./palette-search-types.js";
|
|
30
31
|
export type * from "./query-understanding-types.js";
|
|
31
|
-
export type * from "./match-types.js";
|
|
32
|
-
export { MATCH_ERROR_REASONS, MATCH_IMAGE_TYPES, MATCH_OUTCOMES, MATCH_MATERIAL_FUNCTIONS, MATCH_STREAM_EVENT_TYPES, MATCH_SURFACE_STATUSES, MATCH_WORKFLOW_STEPS, } from "./match-stream-types.js";
|
|
33
|
-
export type * from "./match-stream-types.js";
|
|
34
32
|
export type * from "./material-query-plan-types.js";
|
|
35
33
|
export type * from "./association-types.js";
|
|
36
34
|
export type * from "./brand-types.js";
|
package/index.js
CHANGED
|
@@ -5,6 +5,5 @@ 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
7
|
export { ColoursClient } from "./colours-client.js";
|
|
8
|
-
export { MATCH_ERROR_REASONS, MATCH_IMAGE_TYPES, MATCH_OUTCOMES, MATCH_MATERIAL_FUNCTIONS, MATCH_STREAM_EVENT_TYPES, MATCH_SURFACE_STATUSES, MATCH_WORKFLOW_STEPS, } from "./match-stream-types.js";
|
|
9
8
|
export { CERTIFICATION_PROGRAMME_ATTRIBUTE_ID } from "./spec-types.js";
|
|
10
9
|
export { certificationProgramme, hasSpec, specTerm } from "./specifications.js";
|
package/list-variants-types.d.ts
CHANGED
|
@@ -26,20 +26,33 @@ export type FilterPresenceCondition = {
|
|
|
26
26
|
op: "exists" | "missing";
|
|
27
27
|
};
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* A term stated under ANY of `fields` (2–8 distinct term attributes), for a
|
|
30
|
+
* concept stored under several of them. `in`: at least one of `values` under
|
|
31
|
+
* at least one field. `not_in`: at least one field stated at all, and none of
|
|
32
|
+
* `values` under any field.
|
|
33
|
+
*/
|
|
34
|
+
export type FilterAnyFieldCondition = {
|
|
35
|
+
fields: string[];
|
|
36
|
+
op: "in" | "not_in";
|
|
37
|
+
values: string[];
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* One filter condition, whichever of the four fully-required shapes. No
|
|
30
41
|
* `unit` key (a numeric value is in the attribute's own canonical unit).
|
|
31
42
|
*/
|
|
32
|
-
export type FilterCondition = FilterTermCondition | FilterNumericCondition | FilterPresenceCondition;
|
|
43
|
+
export type FilterCondition = FilterTermCondition | FilterNumericCondition | FilterPresenceCondition | FilterAnyFieldCondition;
|
|
33
44
|
/**
|
|
34
45
|
* `filters`: kind-grouped, not a flat list (MG-2222) — `{terms, numbers,
|
|
35
|
-
* presence}`. Every condition across all
|
|
36
|
-
* within one field is `in
|
|
37
|
-
* empty array carries no
|
|
46
|
+
* presence, anyField}`. Every condition across all four arrays must match
|
|
47
|
+
* (AND); OR within one field is `in`, and `anyField` is OR across several
|
|
48
|
+
* fields. Send only the arrays you need; an omitted or empty array carries no
|
|
49
|
+
* conditions.
|
|
38
50
|
*/
|
|
39
51
|
export type FilterGroups = {
|
|
40
52
|
terms?: FilterTermCondition[];
|
|
41
53
|
numbers?: FilterNumericCondition[];
|
|
42
54
|
presence?: FilterPresenceCondition[];
|
|
55
|
+
anyField?: FilterAnyFieldCondition[];
|
|
43
56
|
};
|
|
44
57
|
/** `optionalFilters`: the same kind-grouped shape as `filters`, with every entry also carrying a required `weight` (1–10). Ranks matched items; never excludes. */
|
|
45
58
|
export type OptionalFilterGroups = {
|
|
@@ -52,6 +65,9 @@ export type OptionalFilterGroups = {
|
|
|
52
65
|
presence?: (FilterPresenceCondition & {
|
|
53
66
|
weight: number;
|
|
54
67
|
})[];
|
|
68
|
+
anyField?: (FilterAnyFieldCondition & {
|
|
69
|
+
weight: number;
|
|
70
|
+
})[];
|
|
55
71
|
};
|
|
56
72
|
export type OrderByEntry = {
|
|
57
73
|
direction: "asc" | "desc";
|
|
@@ -59,23 +75,44 @@ export type OrderByEntry = {
|
|
|
59
75
|
field: string;
|
|
60
76
|
};
|
|
61
77
|
export type ListVariantsInclude = "image" | "url";
|
|
62
|
-
export type ListVariantsCollapse = "product";
|
|
78
|
+
export type ListVariantsCollapse = "product" | "colourway";
|
|
79
|
+
/** 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 = {
|
|
81
|
+
chroma: [number, number];
|
|
82
|
+
hue: [number, number] | null;
|
|
83
|
+
lightness: [number, number];
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* A measured-colour condition. `in` keeps a variant with a large swatch inside
|
|
87
|
+
* `range`; `not_in` leaves those out and lets a variant with no measured
|
|
88
|
+
* colour pass. `preferred` only orders and never narrows.
|
|
89
|
+
*/
|
|
90
|
+
export type ColourRangeCondition = {
|
|
91
|
+
/** The colour's own point in the region, `#rrggbb`; it orders matches, nearest first. */
|
|
92
|
+
hex: string;
|
|
93
|
+
intent?: "required" | "preferred";
|
|
94
|
+
op: "in" | "not_in";
|
|
95
|
+
range: ColourRegion;
|
|
96
|
+
};
|
|
63
97
|
export type ListVariantsInput = {
|
|
64
98
|
/** Attribute ids to project under each item's `specifications`. */
|
|
65
99
|
attributes?: string[];
|
|
66
100
|
/**
|
|
67
101
|
* `product`: one row per product, its lead colourway by the page's order,
|
|
68
102
|
* with `variantCount` saying how many colourways stand behind it. The
|
|
69
|
-
* cursor pages products.
|
|
103
|
+
* cursor pages products. `colourway`: one row per colourway, so a colour
|
|
104
|
+
* sold on several substrates is one row.
|
|
70
105
|
*/
|
|
71
106
|
collapse?: ListVariantsCollapse;
|
|
107
|
+
/** Up to four measured-colour regions. */
|
|
108
|
+
colours?: ColourRangeCondition[];
|
|
72
109
|
/**
|
|
73
110
|
* Only variants in this corpus scope: the rows, the page and the cursor.
|
|
74
111
|
* Absent or `all` is every variant.
|
|
75
112
|
*/
|
|
76
113
|
corpusScope?: CorpusScope;
|
|
77
114
|
cursor?: string;
|
|
78
|
-
/** Every condition, across `terms`/`numbers`/`presence`, must match. */
|
|
115
|
+
/** Every condition, across `terms`/`numbers`/`presence`/`anyField`, must match. */
|
|
79
116
|
filters?: FilterGroups;
|
|
80
117
|
include?: ListVariantsInclude[];
|
|
81
118
|
/** 1–50; defaults to 10. */
|
|
@@ -89,10 +126,12 @@ export type ListVariantsInput = {
|
|
|
89
126
|
/** Rank only — never excludes. */
|
|
90
127
|
optionalFilters?: OptionalFilterGroups;
|
|
91
128
|
orderBy?: OrderByEntry[];
|
|
129
|
+
/** Words each variant must name in its text, inside the filters. */
|
|
130
|
+
words?: string[];
|
|
92
131
|
};
|
|
93
132
|
/**
|
|
94
133
|
* `score` sums the weights of the matched `optionalFilters`; `matched` lists
|
|
95
|
-
* their positions in the flattened terms-then-numbers-then-presence order
|
|
134
|
+
* their positions in the flattened terms-then-numbers-then-presence-then-anyField order
|
|
96
135
|
* the server reads `optionalFilters` in, not the caller's own array shape.
|
|
97
136
|
*/
|
|
98
137
|
export type ListVariantsPreference = {
|
package/ndjson.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A minimal, dependency-free NDJSON (newline-delimited JSON) line reader — the
|
|
3
|
-
* primitive
|
|
3
|
+
* primitive for line-oriented JSON streams. Hand-rolled so the
|
|
4
4
|
* SDK stays zero-runtime-dep and works unchanged inside Node route handlers,
|
|
5
5
|
* where `fetch` yields a byte `ReadableStream`.
|
|
6
6
|
*
|
package/ndjson.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A minimal, dependency-free NDJSON (newline-delimited JSON) line reader — the
|
|
3
|
-
* primitive
|
|
3
|
+
* primitive for line-oriented JSON streams. Hand-rolled so the
|
|
4
4
|
* SDK stays zero-runtime-dep and works unchanged inside Node route handlers,
|
|
5
5
|
* where `fetch` yields a byte `ReadableStream`.
|
|
6
6
|
*
|
package/operations.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const MATERIALGRAPH_API_VERSION = "0.7.0";
|
|
2
|
-
declare const OPERATION_DEFINITIONS: readonly [readonly ["samplizeColorVecCache", "GET", "/api/v1/catalogues/samplize/colorvec", "samplize_colorvec_cache"], readonly ["samplizeCatalogueSearch", "POST", "/api/v1/catalogues/samplize/search", "samplize_catalogue_search"], readonly ["catalogs", "GET", "/api/v1/catalogs", "list_catalog_documents"], readonly ["catalogPages", "GET", "/api/v1/catalogs/{catalogId}/pages", "list_catalog_pages"], readonly ["catalogPageRepresentation", "GET", "/api/v1/catalog-pages/{pageId}/representation", "get_catalog_page_representation"], readonly ["catalogReferences", "GET", "/api/v1/catalogs/{catalogId}/references", "list_catalog_product_references"], readonly ["search", "POST", "/api/v1/search", "search_materials_post"], readonly ["
|
|
2
|
+
declare const OPERATION_DEFINITIONS: readonly [readonly ["samplizeColorVecCache", "GET", "/api/v1/catalogues/samplize/colorvec", "samplize_colorvec_cache"], readonly ["samplizeCatalogueSearch", "POST", "/api/v1/catalogues/samplize/search", "samplize_catalogue_search"], readonly ["catalogs", "GET", "/api/v1/catalogs", "list_catalog_documents"], readonly ["catalogPages", "GET", "/api/v1/catalogs/{catalogId}/pages", "list_catalog_pages"], readonly ["catalogPageRepresentation", "GET", "/api/v1/catalog-pages/{pageId}/representation", "get_catalog_page_representation"], readonly ["catalogReferences", "GET", "/api/v1/catalogs/{catalogId}/references", "list_catalog_product_references"], readonly ["search", "POST", "/api/v1/search", "search_materials_post"], readonly ["planQuery", "POST", "/api/v1/search/plan", "plan_material_query"], readonly ["samplizeCatalogue", "GET", "/api/v1/catalogues/samplize/products", "samplize_catalogue_products"], readonly ["searchGet", "GET", "/api/v1/search", "search_materials_get"], readonly ["byColour", "GET", "/api/v1/search/colours", "search_by_colour"], readonly ["catalogueReferences", "POST", "/api/v1/catalogues/references", "get_catalogue_references_batch"], readonly ["catalogueCollections", "GET", "/api/v1/catalogues/collections", "list_catalogue_channel_collections"], readonly ["catalogueDocumentAccess", "GET", "/api/v1/catalogues/documents/{documentId}", "get_catalogue_document_access"], readonly ["materialBlocks", "GET", "/api/v1/materials/{variantId}/blocks", "list_material_blocks"], readonly ["listVariantAssets", "GET", "/api/v1/variants/{variantId}/assets", "list_variant_assets"], readonly ["materialDocuments", "GET", "/api/v1/materials/{variantId}/documents", "list_material_documents"], readonly ["schema", "GET", "/api/v1/schema/value-dictionaries", "list_schema_value_dictionaries"], readonly ["pairings", "GET", "/api/v1/materials/{variantId}/pairings", "get_material_pairings"], readonly ["associatedFinishes", "GET", "/api/v1/associated/finishes", "list_associated_finishes"], readonly ["associatedProducts", "GET", "/api/v1/associated/products", "list_associated_products"], readonly ["applicability", "GET", "/api/v1/applicability", "get_applicability"], readonly ["listVariants", "GET", "/api/v1/variants", "list_variants"], readonly ["listVariantFacets", "POST", "/api/v1/variants/facets", "list_variant_facets"], readonly ["searchVariants", "POST", "/api/v1/variants/search", "search_variants"], readonly ["findVariantsByColour", "POST", "/api/v1/variants/by-colour", "find_variants_by_colour"], readonly ["findVariantsByVector", "POST", "/api/v1/variants/by-vector", "find_variants_by_vector"], readonly ["findCompanions", "POST", "/api/v1/variants/companions", "find_companions"], readonly ["resolveVariant", "POST", "/api/v1/variants/resolve", "resolve_variant"], readonly ["getVariant", "GET", "/api/v1/variants/{variantId}", "get_variant"], readonly ["resolveColour", "GET", "/api/v1/search/colours/resolve", "resolve_colour_name"], readonly ["listAttributes", "GET", "/api/v1/catalog/attributes", "catalog_list_attributes"], readonly ["listEnumValues", "GET", "/api/v1/catalog/enum-values", "catalog_list_enum_values"], readonly ["categories.list", "GET", "/api/v1/categories", "list_categories"], readonly ["categories.get", "GET", "/api/v1/categories/{id}", "get_category"], readonly ["whoami", "GET", "/api/v1/whoami", "whoami"], readonly ["colours.palette", "POST", "/api/v1/search/palettes", "search_by_palette"], readonly ["extractPalette", "POST", "/api/v1/search/palettes/extract", "extract_image_palette"], readonly ["brands", "GET", "/api/v1/brands", "list_brands"], readonly ["uploadSourceMaterial", "POST", "/api/v1/source-material", "upload_source_material"], readonly ["workflows.start", "POST", "/api/v1/workflows/{workflowId}/runs", "create_public_run"], readonly ["workflows.run", "GET", "/api/v1/workflows/{workflowId}/runs/{runId}", "get_public_run"], readonly ["citation", "GET", "/api/v1/citations/{citationId}", "get_verdict_citation"], readonly ["workflows.streamRunEvents", "GET", "/api/v1/workflows/{workflowId}/runs/{runId}/events", "list_public_run_events"]];
|
|
3
3
|
export type SdkOperationId = (typeof OPERATION_DEFINITIONS)[number][3];
|
|
4
4
|
export type SdkOperation = Readonly<{
|
|
5
5
|
clientMethod: (typeof OPERATION_DEFINITIONS)[number][0];
|
package/operations.js
CHANGED
|
@@ -33,7 +33,6 @@ const OPERATION_DEFINITIONS = [
|
|
|
33
33
|
"list_catalog_product_references",
|
|
34
34
|
],
|
|
35
35
|
["search", "POST", "/api/v1/search", "search_materials_post"],
|
|
36
|
-
["match", "POST", "/api/v1/search/match", "match_material"],
|
|
37
36
|
["planQuery", "POST", "/api/v1/search/plan", "plan_material_query"],
|
|
38
37
|
[
|
|
39
38
|
"samplizeCatalogue",
|
|
@@ -111,6 +110,7 @@ const OPERATION_DEFINITIONS = [
|
|
|
111
110
|
"/api/v1/variants/facets",
|
|
112
111
|
"list_variant_facets",
|
|
113
112
|
],
|
|
113
|
+
["searchVariants", "POST", "/api/v1/variants/search", "search_variants"],
|
|
114
114
|
[
|
|
115
115
|
"findVariantsByColour",
|
|
116
116
|
"POST",
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** The API contract version the schemas were generated from. */
|
|
2
2
|
export declare const RESPONSE_SCHEMA_API_VERSION = "0.7.0";
|
|
3
3
|
/** Every SDK operation whose success response has a published JSON Schema. */
|
|
4
|
-
export declare const RESPONSE_SCHEMA_OPERATION_IDS: readonly ["samplize_colorvec_cache", "samplize_catalogue_search", "list_catalog_documents", "list_catalog_pages", "get_catalog_page_representation", "list_catalog_product_references", "search_materials_post", "
|
|
4
|
+
export declare const RESPONSE_SCHEMA_OPERATION_IDS: readonly ["samplize_colorvec_cache", "samplize_catalogue_search", "list_catalog_documents", "list_catalog_pages", "get_catalog_page_representation", "list_catalog_product_references", "search_materials_post", "plan_material_query", "samplize_catalogue_products", "search_materials_get", "search_by_colour", "get_catalogue_references_batch", "list_catalogue_channel_collections", "get_catalogue_document_access", "list_material_blocks", "list_variant_assets", "list_material_documents", "list_schema_value_dictionaries", "get_material_pairings", "list_associated_finishes", "list_associated_products", "get_applicability", "list_variants", "list_variant_facets", "search_variants", "find_variants_by_colour", "find_variants_by_vector", "find_companions", "resolve_variant", "get_variant", "resolve_colour_name", "catalog_list_attributes", "catalog_list_enum_values", "list_categories", "get_category", "whoami", "search_by_palette", "extract_image_palette", "list_brands", "upload_source_material", "create_public_run", "get_public_run", "get_verdict_citation"];
|
|
5
5
|
export declare const RESPONSE_SCHEMA_CATALOGUE_JSON: string;
|